Skip to content

Commit ac56ca0

Browse files
committed
Separate __call and __soapCall implementations
This is overly pedantic, but allows us to enable more arginfo consistency checks.
1 parent 4dd8fec commit ac56ca0

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

ext/soap/soap.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,7 +2512,7 @@ static void verify_soap_headers_array(HashTable *ht) /* {{{ */
25122512
/* }}} */
25132513

25142514
/* {{{ Calls a SOAP function */
2515-
PHP_METHOD(SoapClient, __call)
2515+
void soap_client_call_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_soap_call)
25162516
{
25172517
char *function, *location=NULL, *soap_action = NULL, *uri = NULL;
25182518
size_t function_len;
@@ -2529,9 +2529,15 @@ PHP_METHOD(SoapClient, __call)
25292529
zend_bool free_soap_headers = 0;
25302530
zval *this_ptr;
25312531

2532-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz",
2533-
&function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) {
2534-
RETURN_THROWS();
2532+
if (is_soap_call) {
2533+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz",
2534+
&function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) {
2535+
RETURN_THROWS();
2536+
}
2537+
} else {
2538+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa", &function, &function_len, &args) == FAILURE) {
2539+
RETURN_THROWS();
2540+
}
25352541
}
25362542

25372543
if (options) {
@@ -2620,6 +2626,15 @@ PHP_METHOD(SoapClient, __call)
26202626
}
26212627
/* }}} */
26222628

2629+
PHP_METHOD(SoapClient, __call)
2630+
{
2631+
soap_client_call_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
2632+
}
2633+
2634+
PHP_METHOD(SoapClient, __soapCall)
2635+
{
2636+
soap_client_call_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
2637+
}
26232638

26242639
/* {{{ Returns list of SOAP functions */
26252640
PHP_METHOD(SoapClient, __getFunctions)

ext/soap/soap.stub.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ public function __construct($wsdl, array $options = []) {}
6464
/** @return mixed */
6565
public function __call(string $function_name, array $arguments) {}
6666

67-
/**
68-
* @return mixed
69-
* @alias SoapClient::__call
70-
*/
67+
/** @return mixed */
7168
public function __soapCall(string $function_name, array $arguments, ?array $options = null, $input_headers = null, $output_headers = null) {}
7269

7370
/** @return array|null */

ext/soap/soap_arginfo.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 43878ddb4f96ee0a2f409b87bb1484fc5378cfb5 */
2+
* Stub hash: 82152767dbeda492da7dff97324d7277d3f0213b */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, handler, _IS_BOOL, 0, "true")
@@ -153,6 +153,7 @@ ZEND_METHOD(SoapServer, addFunction);
153153
ZEND_METHOD(SoapServer, handle);
154154
ZEND_METHOD(SoapClient, __construct);
155155
ZEND_METHOD(SoapClient, __call);
156+
ZEND_METHOD(SoapClient, __soapCall);
156157
ZEND_METHOD(SoapClient, __getFunctions);
157158
ZEND_METHOD(SoapClient, __getTypes);
158159
ZEND_METHOD(SoapClient, __getLastRequest);
@@ -215,7 +216,7 @@ static const zend_function_entry class_SoapServer_methods[] = {
215216
static const zend_function_entry class_SoapClient_methods[] = {
216217
ZEND_ME(SoapClient, __construct, arginfo_class_SoapClient___construct, ZEND_ACC_PUBLIC)
217218
ZEND_ME(SoapClient, __call, arginfo_class_SoapClient___call, ZEND_ACC_PUBLIC)
218-
ZEND_MALIAS(SoapClient, __soapCall, __call, arginfo_class_SoapClient___soapCall, ZEND_ACC_PUBLIC)
219+
ZEND_ME(SoapClient, __soapCall, arginfo_class_SoapClient___soapCall, ZEND_ACC_PUBLIC)
219220
ZEND_ME(SoapClient, __getFunctions, arginfo_class_SoapClient___getFunctions, ZEND_ACC_PUBLIC)
220221
ZEND_ME(SoapClient, __getTypes, arginfo_class_SoapClient___getTypes, ZEND_ACC_PUBLIC)
221222
ZEND_ME(SoapClient, __getLastRequest, arginfo_class_SoapClient___getLastRequest, ZEND_ACC_PUBLIC)

ext/soap/tests/bugs/bug31755.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $client=new SOAPClient(null, array('location' => 'http://localhost',
99

1010
$header = new SOAPHeader(null, 'foo', 'bar');
1111

12-
$response= $client->__call('function', array(), null, $header);
12+
$response= $client->__soapCall('function', array(), null, $header);
1313

1414
print $client->__getLastRequest();
1515
?>

0 commit comments

Comments
 (0)