diff options
Diffstat (limited to 'ext/soap')
-rw-r--r-- | ext/soap/soap.c | 76 | ||||
-rw-r--r-- | ext/soap/tests/bug77088.phpt | 21 | ||||
-rw-r--r-- | ext/soap/tests/bugs/bug31422.phpt | 5 | ||||
-rw-r--r-- | ext/soap/tests/bugs/bug31755.phpt | 2 | ||||
-rw-r--r-- | ext/soap/tests/fault_warning.phpt | 8 |
5 files changed, 51 insertions, 61 deletions
diff --git a/ext/soap/soap.c b/ext/soap/soap.c index ce776efb3f..3f1e7186a4 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -197,7 +197,7 @@ PHP_FUNCTION(is_soap_fault); /* Server Functions */ -PHP_METHOD(SoapServer, SoapServer); +PHP_METHOD(SoapServer, __construct); PHP_METHOD(SoapServer, setClass); PHP_METHOD(SoapServer, setObject); PHP_METHOD(SoapServer, addFunction); @@ -208,7 +208,7 @@ PHP_METHOD(SoapServer, fault); PHP_METHOD(SoapServer, addSoapHeader); /* Client Functions */ -PHP_METHOD(SoapClient, SoapClient); +PHP_METHOD(SoapClient, __construct); PHP_METHOD(SoapClient, __call); PHP_METHOD(SoapClient, __getLastRequest); PHP_METHOD(SoapClient, __getLastResponse); @@ -223,30 +223,28 @@ PHP_METHOD(SoapClient, __setLocation); PHP_METHOD(SoapClient, __setSoapHeaders); /* SoapVar Functions */ -PHP_METHOD(SoapVar, SoapVar); +PHP_METHOD(SoapVar, __construct); /* SoapFault Functions */ -PHP_METHOD(SoapFault, SoapFault); +PHP_METHOD(SoapFault, __construct); PHP_METHOD(SoapFault, __toString); /* SoapParam Functions */ -PHP_METHOD(SoapParam, SoapParam); +PHP_METHOD(SoapParam, __construct); /* SoapHeader Functions */ -PHP_METHOD(SoapHeader, SoapHeader); - -#define SOAP_CTOR(class_name, func_name, arginfo, flags) PHP_ME(class_name, func_name, arginfo, flags) +PHP_METHOD(SoapHeader, __construct); /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO(arginfo_soap__void, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam_soapparam, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam___construct, 0, 0, 2) ZEND_ARG_INFO(0, data) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader___construct, 0, 0, 2) ZEND_ARG_INFO(0, namespace) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, data) @@ -254,7 +252,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2) ZEND_ARG_INFO(0, actor) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault___construct, 0, 0, 2) ZEND_ARG_INFO(0, faultcode) ZEND_ARG_INFO(0, faultstring) ZEND_ARG_INFO(0, faultactor) @@ -263,7 +261,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2) ZEND_ARG_INFO(0, headerfault) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar___construct, 0, 0, 2) ZEND_ARG_INFO(0, data) ZEND_ARG_INFO(0, encoding) ZEND_ARG_INFO(0, type_name) @@ -284,7 +282,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addsoapheader, 0, 0, 1) ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_soapserver, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver___construct, 0, 0, 1) ZEND_ARG_INFO(0, wsdl) ZEND_ARG_INFO(0, options) ZEND_END_ARG_INFO() @@ -313,7 +311,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_handle, 0, 0, 0) ZEND_ARG_INFO(0, soap_request) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient_soapclient, 0, 0, 1) +ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___construct, 0, 0, 1) ZEND_ARG_INFO(0, wsdl) ZEND_ARG_INFO(0, options) ZEND_END_ARG_INFO() @@ -389,13 +387,13 @@ static const zend_function_entry soap_functions[] = { }; static const zend_function_entry soap_fault_functions[] = { - SOAP_CTOR(SoapFault, SoapFault, arginfo_soapfault_soapfault, 0) + PHP_ME(SoapFault, __construct, arginfo_soapfault___construct, 0) PHP_ME(SoapFault, __toString, arginfo_soap__void, 0) PHP_FE_END }; static const zend_function_entry soap_server_functions[] = { - SOAP_CTOR(SoapServer, SoapServer, arginfo_soapserver_soapserver, 0) + PHP_ME(SoapServer, __construct, arginfo_soapserver___construct, 0) PHP_ME(SoapServer, setPersistence, arginfo_soapserver_setpersistence, 0) PHP_ME(SoapServer, setClass, arginfo_soapserver_setclass, 0) PHP_ME(SoapServer, setObject, arginfo_soapserver_setobject, 0) @@ -408,7 +406,7 @@ static const zend_function_entry soap_server_functions[] = { }; static const zend_function_entry soap_client_functions[] = { - SOAP_CTOR(SoapClient, SoapClient, arginfo_soapclient_soapclient, 0) + PHP_ME(SoapClient, __construct, arginfo_soapclient___construct, 0) PHP_ME(SoapClient, __call, arginfo_soapclient___call, 0) ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_soapclient___soapcall, 0) PHP_ME(SoapClient, __getLastRequest, arginfo_soapclient___getlastrequest, 0) @@ -426,17 +424,17 @@ static const zend_function_entry soap_client_functions[] = { }; static const zend_function_entry soap_var_functions[] = { - SOAP_CTOR(SoapVar, SoapVar, arginfo_soapvar_soapvar, 0) + PHP_ME(SoapVar, __construct, arginfo_soapvar___construct, 0) PHP_FE_END }; static const zend_function_entry soap_param_functions[] = { - SOAP_CTOR(SoapParam, SoapParam, arginfo_soapparam_soapparam, 0) + PHP_ME(SoapParam, __construct, arginfo_soapparam___construct, 0) PHP_FE_END }; static const zend_function_entry soap_header_functions[] = { - SOAP_CTOR(SoapHeader, SoapHeader, arginfo_soapheader_soapheader, 0) + PHP_ME(SoapHeader, __construct, arginfo_soapheader___construct, 0) PHP_FE_END }; @@ -785,9 +783,9 @@ PHP_MINFO_FUNCTION(soap) } -/* {{{ proto object SoapParam::SoapParam(mixed data, string name) +/* {{{ proto object SoapParam::__construct(mixed data, string name) SoapParam constructor */ -PHP_METHOD(SoapParam, SoapParam) +PHP_METHOD(SoapParam, __construct) { zval *data; char *name; @@ -809,9 +807,9 @@ PHP_METHOD(SoapParam, SoapParam) /* }}} */ -/* {{{ proto object SoapHeader::SoapHeader(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]]) +/* {{{ proto object SoapHeader::__construct(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]]) SoapHeader constructor */ -PHP_METHOD(SoapHeader, SoapHeader) +PHP_METHOD(SoapHeader, __construct) { zval *data = NULL, *actor = NULL; char *name, *ns; @@ -852,9 +850,9 @@ PHP_METHOD(SoapHeader, SoapHeader) } /* }}} */ -/* {{{ proto object SoapFault::SoapFault(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]]) +/* {{{ proto object SoapFault::__construct(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]]) SoapFault constructor */ -PHP_METHOD(SoapFault, SoapFault) +PHP_METHOD(SoapFault, __construct) { char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL; size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0; @@ -955,9 +953,9 @@ PHP_METHOD(SoapFault, __toString) } /* }}} */ -/* {{{ proto object SoapVar::SoapVar(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]]) +/* {{{ proto object SoapVar::__construct(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]]) SoapVar constructor */ -PHP_METHOD(SoapVar, SoapVar) +PHP_METHOD(SoapVar, __construct) { zval *data, *type, *this_ptr; char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL; @@ -1102,9 +1100,9 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */ } /* }}} */ -/* {{{ proto object SoapServer::SoapServer(mixed wsdl [, array options]) +/* {{{ proto object SoapServer::__construct(mixed wsdl [, array options]) SoapServer constructor */ -PHP_METHOD(SoapServer, SoapServer) +PHP_METHOD(SoapServer, __construct) { soapServicePtr service; zval *wsdl = NULL, *options = NULL; @@ -1113,12 +1111,12 @@ PHP_METHOD(SoapServer, SoapServer) zend_long cache_wsdl; HashTable *typemap_ht = NULL; - SOAP_SERVER_BEGIN_CODE(); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); + return; } + SOAP_SERVER_BEGIN_CODE(); + if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { php_error_docref(NULL, E_ERROR, "Invalid parameters"); } @@ -2265,15 +2263,15 @@ PHP_FUNCTION(is_soap_fault) instanceof_function(Z_OBJCE_P(fault), soap_fault_class_entry)) { RETURN_TRUE; } - RETURN_FALSE + RETURN_FALSE; } /* }}} */ /* SoapClient functions */ -/* {{{ proto object SoapClient::SoapClient(mixed wsdl [, array options]) +/* {{{ proto object SoapClient::__construct(mixed wsdl [, array options]) SoapClient constructor */ -PHP_METHOD(SoapClient, SoapClient) +PHP_METHOD(SoapClient, __construct) { zval *wsdl, *options = NULL; @@ -2284,12 +2282,12 @@ PHP_METHOD(SoapClient, SoapClient) HashTable *typemap_ht = NULL; zval *this_ptr = ZEND_THIS; - SOAP_CLIENT_BEGIN_CODE(); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a", &wsdl, &options) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Invalid parameters"); + return; } + SOAP_CLIENT_BEGIN_CODE(); + if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) { php_error_docref(NULL, E_ERROR, "$wsdl must be string or null"); } diff --git a/ext/soap/tests/bug77088.phpt b/ext/soap/tests/bug77088.phpt index 0c1a604f2e..e6f5e7582e 100644 --- a/ext/soap/tests/bug77088.phpt +++ b/ext/soap/tests/bug77088.phpt @@ -12,18 +12,17 @@ try $options = NULL; $sClient = new SoapClient("test.wsdl", $options); } -catch(SoapFault $e) +catch(TypeError $e) { var_dump($e); } ?> --EXPECTF-- -Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d -object(SoapFault)#%d (%d) { +object(TypeError)#%d (%d) { ["message":protected]=> - string(44) "SoapClient::SoapClient(): Invalid parameters" - ["string":"Exception":private]=> + string(%d) "SoapClient::__construct() expects parameter 2 to be array, null given" + ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) @@ -31,7 +30,7 @@ object(SoapFault)#%d (%d) { string(%d) "%sbug77088.php" ["line":protected]=> int(6) - ["trace":"Exception":private]=> + ["trace":"Error":private]=> array(1) { [0]=> array(6) { @@ -40,7 +39,7 @@ object(SoapFault)#%d (%d) { ["line"]=> int(6) ["function"]=> - string(10) "SoapClient" + string(11) "__construct" ["class"]=> string(10) "SoapClient" ["type"]=> @@ -54,12 +53,6 @@ object(SoapFault)#%d (%d) { } } } - ["previous":"Exception":private]=> + ["previous":"Error":private]=> NULL - ["faultstring"]=> - string(44) "SoapClient::SoapClient(): Invalid parameters" - ["faultcode"]=> - string(6) "Client" - ["faultcodens"]=> - string(41) "http://schemas.xmlsoap.org/soap/envelope/" } diff --git a/ext/soap/tests/bugs/bug31422.phpt b/ext/soap/tests/bugs/bug31422.phpt index 4889b10d8e..152781a4ec 100644 --- a/ext/soap/tests/bugs/bug31422.phpt +++ b/ext/soap/tests/bugs/bug31422.phpt @@ -39,7 +39,6 @@ $server->handle($HTTP_RAW_POST_DATA); echo "ok\n"; ?> --EXPECTF-- -PHP Warning: fopen() expects at least 2 parameters, 0 given in %sbug31422.php on line %d -PHP Fatal error: Hello in %sbug31422.php on line %d <?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Hello</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>fopen() expects at least 2 parameters, 0 given</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope> +ok diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt index 1d65b3a42b..600fd43058 100644 --- a/ext/soap/tests/bugs/bug31755.phpt +++ b/ext/soap/tests/bugs/bug31755.phpt @@ -14,6 +14,6 @@ $response= $client->__call('function', array(), null, $header); print $client->__getLastRequest(); ?> --EXPECTF-- -Warning: SoapHeader::SoapHeader(): Invalid namespace in %s on line %d +Warning: SoapHeader::__construct(): Invalid namespace in %s on line %d <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="myNS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns1:function/></SOAP-ENV:Body></SOAP-ENV:Envelope> diff --git a/ext/soap/tests/fault_warning.phpt b/ext/soap/tests/fault_warning.phpt index 98d2d269ea..2ee8bf58ee 100644 --- a/ext/soap/tests/fault_warning.phpt +++ b/ext/soap/tests/fault_warning.phpt @@ -16,13 +16,13 @@ $fault = new SoapFault(["more-ns", "Sender"], "message"); // two given echo get_class($fault); ?> --EXPECTF-- -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d SoapFault SoapFault -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d -Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d +Warning: SoapFault::__construct(): Invalid fault code in %s on line %d SoapFault |