]> granicus.if.org Git - php/commitdiff
Migrate SOAP away from legacy constructors
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 29 Jan 2019 11:59:43 +0000 (12:59 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 29 Jan 2019 12:04:20 +0000 (13:04 +0100)
ext/soap/soap.c
ext/soap/tests/bug77088.phpt
ext/soap/tests/bugs/bug31755.phpt
ext/soap/tests/fault_warning.phpt

index 4888309d2886c120924a0d306e71c420f3092910..84c6ce492bb78001e2a2643da57ca972033c68e8 100644 (file)
@@ -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;
@@ -2256,9 +2254,9 @@ PHP_FUNCTION(is_soap_fault)
 
 /* 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;
index 0c1a604f2e8316bd435cd1fd9b04f0e6b59ba7c6..413529bcaac091cd3370d45cfd1a344eb848d7c2 100644 (file)
@@ -19,10 +19,10 @@ catch(SoapFault $e)
 
 ?>
 --EXPECTF--
-Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d
+Warning: SoapClient::__construct() expects parameter 2 to be array, null given in %sbug77088.php on line %d
 object(SoapFault)#%d (%d) {
   ["message":protected]=>
-  string(44) "SoapClient::SoapClient(): Invalid parameters"
+  string(%d) "SoapClient::__construct(): Invalid parameters"
   ["string":"Exception":private]=>
   string(0) ""
   ["code":protected]=>
@@ -40,7 +40,7 @@ object(SoapFault)#%d (%d) {
       ["line"]=>
       int(6)
       ["function"]=>
-      string(10) "SoapClient"
+      string(11) "__construct"
       ["class"]=>
       string(10) "SoapClient"
       ["type"]=>
@@ -57,7 +57,7 @@ object(SoapFault)#%d (%d) {
   ["previous":"Exception":private]=>
   NULL
   ["faultstring"]=>
-  string(44) "SoapClient::SoapClient(): Invalid parameters"
+  string(%d) "SoapClient::__construct(): Invalid parameters"
   ["faultcode"]=>
   string(6) "Client"
   ["faultcodens"]=>
index 1d65b3a42b09ea3fc85fca0ecab51a283eb7ea0c..600fd4305868813342baf8cd8827f3acc7430b02 100644 (file)
@@ -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>
index 98d2d269ea3e804c5d2274ba1982ff3ac608ad91..2ee8bf58eed217113d5316137879feabc37d3d40 100644 (file)
@@ -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