From: Nikita Popov Date: Tue, 21 Jul 2020 10:58:52 +0000 (+0200) Subject: Separate __call and __soapCall implementations X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac56ca0dccc2ce0e1b8e7f8a96cff39ac49a1670;p=php Separate __call and __soapCall implementations This is overly pedantic, but allows us to enable more arginfo consistency checks. --- diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 846f3331b4..9b12cea48a 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -2512,7 +2512,7 @@ static void verify_soap_headers_array(HashTable *ht) /* {{{ */ /* }}} */ /* {{{ Calls a SOAP function */ -PHP_METHOD(SoapClient, __call) +void soap_client_call_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_soap_call) { char *function, *location=NULL, *soap_action = NULL, *uri = NULL; size_t function_len; @@ -2529,9 +2529,15 @@ PHP_METHOD(SoapClient, __call) zend_bool free_soap_headers = 0; zval *this_ptr; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz", - &function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) { - RETURN_THROWS(); + if (is_soap_call) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa|a!zz", + &function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) { + RETURN_THROWS(); + } + } else { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sa", &function, &function_len, &args) == FAILURE) { + RETURN_THROWS(); + } } if (options) { @@ -2620,6 +2626,15 @@ cleanup: } /* }}} */ +PHP_METHOD(SoapClient, __call) +{ + soap_client_call_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); +} + +PHP_METHOD(SoapClient, __soapCall) +{ + soap_client_call_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); +} /* {{{ Returns list of SOAP functions */ PHP_METHOD(SoapClient, __getFunctions) diff --git a/ext/soap/soap.stub.php b/ext/soap/soap.stub.php index 5e8e2eca28..60bfd5c65e 100644 --- a/ext/soap/soap.stub.php +++ b/ext/soap/soap.stub.php @@ -64,10 +64,7 @@ class SoapClient /** @return mixed */ public function __call(string $function_name, array $arguments) {} - /** - * @return mixed - * @alias SoapClient::__call - */ + /** @return mixed */ public function __soapCall(string $function_name, array $arguments, ?array $options = null, $input_headers = null, $output_headers = null) {} /** @return array|null */ diff --git a/ext/soap/soap_arginfo.h b/ext/soap/soap_arginfo.h index d012bc4d06..9ce8df198b 100644 --- a/ext/soap/soap_arginfo.h +++ b/ext/soap/soap_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 43878ddb4f96ee0a2f409b87bb1484fc5378cfb5 */ + * Stub hash: 82152767dbeda492da7dff97324d7277d3f0213b */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, handler, _IS_BOOL, 0, "true") @@ -153,6 +153,7 @@ ZEND_METHOD(SoapServer, addFunction); ZEND_METHOD(SoapServer, handle); ZEND_METHOD(SoapClient, __construct); ZEND_METHOD(SoapClient, __call); +ZEND_METHOD(SoapClient, __soapCall); ZEND_METHOD(SoapClient, __getFunctions); ZEND_METHOD(SoapClient, __getTypes); ZEND_METHOD(SoapClient, __getLastRequest); @@ -215,7 +216,7 @@ static const zend_function_entry class_SoapServer_methods[] = { static const zend_function_entry class_SoapClient_methods[] = { ZEND_ME(SoapClient, __construct, arginfo_class_SoapClient___construct, ZEND_ACC_PUBLIC) ZEND_ME(SoapClient, __call, arginfo_class_SoapClient___call, ZEND_ACC_PUBLIC) - ZEND_MALIAS(SoapClient, __soapCall, __call, arginfo_class_SoapClient___soapCall, ZEND_ACC_PUBLIC) + ZEND_ME(SoapClient, __soapCall, arginfo_class_SoapClient___soapCall, ZEND_ACC_PUBLIC) ZEND_ME(SoapClient, __getFunctions, arginfo_class_SoapClient___getFunctions, ZEND_ACC_PUBLIC) ZEND_ME(SoapClient, __getTypes, arginfo_class_SoapClient___getTypes, ZEND_ACC_PUBLIC) ZEND_ME(SoapClient, __getLastRequest, arginfo_class_SoapClient___getLastRequest, ZEND_ACC_PUBLIC) diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt index 600fd43058..d3c7ea8984 100644 --- a/ext/soap/tests/bugs/bug31755.phpt +++ b/ext/soap/tests/bugs/bug31755.phpt @@ -9,7 +9,7 @@ $client=new SOAPClient(null, array('location' => 'http://localhost', $header = new SOAPHeader(null, 'foo', 'bar'); -$response= $client->__call('function', array(), null, $header); +$response= $client->__soapCall('function', array(), null, $header); print $client->__getLastRequest(); ?>