Skip to content

Commit 371e427

Browse files
committed
Migrate SOAP away from legacy constructors
1 parent 55dbb57 commit 371e427

File tree

4 files changed

+39
-41
lines changed

4 files changed

+39
-41
lines changed

ext/soap/soap.c

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ PHP_FUNCTION(is_soap_fault);
197197

198198

199199
/* Server Functions */
200-
PHP_METHOD(SoapServer, SoapServer);
200+
PHP_METHOD(SoapServer, __construct);
201201
PHP_METHOD(SoapServer, setClass);
202202
PHP_METHOD(SoapServer, setObject);
203203
PHP_METHOD(SoapServer, addFunction);
@@ -208,7 +208,7 @@ PHP_METHOD(SoapServer, fault);
208208
PHP_METHOD(SoapServer, addSoapHeader);
209209

210210
/* Client Functions */
211-
PHP_METHOD(SoapClient, SoapClient);
211+
PHP_METHOD(SoapClient, __construct);
212212
PHP_METHOD(SoapClient, __call);
213213
PHP_METHOD(SoapClient, __getLastRequest);
214214
PHP_METHOD(SoapClient, __getLastResponse);
@@ -223,38 +223,36 @@ PHP_METHOD(SoapClient, __setLocation);
223223
PHP_METHOD(SoapClient, __setSoapHeaders);
224224

225225
/* SoapVar Functions */
226-
PHP_METHOD(SoapVar, SoapVar);
226+
PHP_METHOD(SoapVar, __construct);
227227

228228
/* SoapFault Functions */
229-
PHP_METHOD(SoapFault, SoapFault);
229+
PHP_METHOD(SoapFault, __construct);
230230
PHP_METHOD(SoapFault, __toString);
231231

232232
/* SoapParam Functions */
233-
PHP_METHOD(SoapParam, SoapParam);
233+
PHP_METHOD(SoapParam, __construct);
234234

235235
/* SoapHeader Functions */
236-
PHP_METHOD(SoapHeader, SoapHeader);
237-
238-
#define SOAP_CTOR(class_name, func_name, arginfo, flags) PHP_ME(class_name, func_name, arginfo, flags)
236+
PHP_METHOD(SoapHeader, __construct);
239237

240238
/* {{{ arginfo */
241239
ZEND_BEGIN_ARG_INFO(arginfo_soap__void, 0)
242240
ZEND_END_ARG_INFO()
243241

244-
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam_soapparam, 0, 0, 2)
242+
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam___construct, 0, 0, 2)
245243
ZEND_ARG_INFO(0, data)
246244
ZEND_ARG_INFO(0, name)
247245
ZEND_END_ARG_INFO()
248246

249-
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2)
247+
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader___construct, 0, 0, 2)
250248
ZEND_ARG_INFO(0, namespace)
251249
ZEND_ARG_INFO(0, name)
252250
ZEND_ARG_INFO(0, data)
253251
ZEND_ARG_INFO(0, mustunderstand)
254252
ZEND_ARG_INFO(0, actor)
255253
ZEND_END_ARG_INFO()
256254

257-
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2)
255+
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault___construct, 0, 0, 2)
258256
ZEND_ARG_INFO(0, faultcode)
259257
ZEND_ARG_INFO(0, faultstring)
260258
ZEND_ARG_INFO(0, faultactor)
@@ -263,7 +261,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2)
263261
ZEND_ARG_INFO(0, headerfault)
264262
ZEND_END_ARG_INFO()
265263

266-
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2)
264+
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar___construct, 0, 0, 2)
267265
ZEND_ARG_INFO(0, data)
268266
ZEND_ARG_INFO(0, encoding)
269267
ZEND_ARG_INFO(0, type_name)
@@ -284,7 +282,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addsoapheader, 0, 0, 1)
284282
ZEND_ARG_INFO(0, object)
285283
ZEND_END_ARG_INFO()
286284

287-
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_soapserver, 0, 0, 1)
285+
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver___construct, 0, 0, 1)
288286
ZEND_ARG_INFO(0, wsdl)
289287
ZEND_ARG_INFO(0, options)
290288
ZEND_END_ARG_INFO()
@@ -313,7 +311,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_handle, 0, 0, 0)
313311
ZEND_ARG_INFO(0, soap_request)
314312
ZEND_END_ARG_INFO()
315313

316-
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient_soapclient, 0, 0, 1)
314+
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___construct, 0, 0, 1)
317315
ZEND_ARG_INFO(0, wsdl)
318316
ZEND_ARG_INFO(0, options)
319317
ZEND_END_ARG_INFO()
@@ -389,13 +387,13 @@ static const zend_function_entry soap_functions[] = {
389387
};
390388

391389
static const zend_function_entry soap_fault_functions[] = {
392-
SOAP_CTOR(SoapFault, SoapFault, arginfo_soapfault_soapfault, 0)
390+
PHP_ME(SoapFault, __construct, arginfo_soapfault___construct, 0)
393391
PHP_ME(SoapFault, __toString, arginfo_soap__void, 0)
394392
PHP_FE_END
395393
};
396394

397395
static const zend_function_entry soap_server_functions[] = {
398-
SOAP_CTOR(SoapServer, SoapServer, arginfo_soapserver_soapserver, 0)
396+
PHP_ME(SoapServer, __construct, arginfo_soapserver___construct, 0)
399397
PHP_ME(SoapServer, setPersistence, arginfo_soapserver_setpersistence, 0)
400398
PHP_ME(SoapServer, setClass, arginfo_soapserver_setclass, 0)
401399
PHP_ME(SoapServer, setObject, arginfo_soapserver_setobject, 0)
@@ -408,7 +406,7 @@ static const zend_function_entry soap_server_functions[] = {
408406
};
409407

410408
static const zend_function_entry soap_client_functions[] = {
411-
SOAP_CTOR(SoapClient, SoapClient, arginfo_soapclient_soapclient, 0)
409+
PHP_ME(SoapClient, __construct, arginfo_soapclient___construct, 0)
412410
PHP_ME(SoapClient, __call, arginfo_soapclient___call, 0)
413411
ZEND_NAMED_ME(__soapCall, ZEND_MN(SoapClient___call), arginfo_soapclient___soapcall, 0)
414412
PHP_ME(SoapClient, __getLastRequest, arginfo_soapclient___getlastrequest, 0)
@@ -426,17 +424,17 @@ static const zend_function_entry soap_client_functions[] = {
426424
};
427425

428426
static const zend_function_entry soap_var_functions[] = {
429-
SOAP_CTOR(SoapVar, SoapVar, arginfo_soapvar_soapvar, 0)
427+
PHP_ME(SoapVar, __construct, arginfo_soapvar___construct, 0)
430428
PHP_FE_END
431429
};
432430

433431
static const zend_function_entry soap_param_functions[] = {
434-
SOAP_CTOR(SoapParam, SoapParam, arginfo_soapparam_soapparam, 0)
432+
PHP_ME(SoapParam, __construct, arginfo_soapparam___construct, 0)
435433
PHP_FE_END
436434
};
437435

438436
static const zend_function_entry soap_header_functions[] = {
439-
SOAP_CTOR(SoapHeader, SoapHeader, arginfo_soapheader_soapheader, 0)
437+
PHP_ME(SoapHeader, __construct, arginfo_soapheader___construct, 0)
440438
PHP_FE_END
441439
};
442440

@@ -785,9 +783,9 @@ PHP_MINFO_FUNCTION(soap)
785783
}
786784

787785

788-
/* {{{ proto object SoapParam::SoapParam(mixed data, string name)
786+
/* {{{ proto object SoapParam::__construct(mixed data, string name)
789787
SoapParam constructor */
790-
PHP_METHOD(SoapParam, SoapParam)
788+
PHP_METHOD(SoapParam, __construct)
791789
{
792790
zval *data;
793791
char *name;
@@ -809,9 +807,9 @@ PHP_METHOD(SoapParam, SoapParam)
809807
/* }}} */
810808

811809

812-
/* {{{ proto object SoapHeader::SoapHeader(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]])
810+
/* {{{ proto object SoapHeader::__construct(string namespace, string name [, mixed data [, bool mustUnderstand [, mixed actor]]])
813811
SoapHeader constructor */
814-
PHP_METHOD(SoapHeader, SoapHeader)
812+
PHP_METHOD(SoapHeader, __construct)
815813
{
816814
zval *data = NULL, *actor = NULL;
817815
char *name, *ns;
@@ -852,9 +850,9 @@ PHP_METHOD(SoapHeader, SoapHeader)
852850
}
853851
/* }}} */
854852

855-
/* {{{ proto object SoapFault::SoapFault(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])
853+
/* {{{ proto object SoapFault::__construct(string faultcode, string faultstring [, string faultactor [, mixed detail [, string faultname [, mixed headerfault]]]])
856854
SoapFault constructor */
857-
PHP_METHOD(SoapFault, SoapFault)
855+
PHP_METHOD(SoapFault, __construct)
858856
{
859857
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL;
860858
size_t fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0;
@@ -955,9 +953,9 @@ PHP_METHOD(SoapFault, __toString)
955953
}
956954
/* }}} */
957955

958-
/* {{{ proto object SoapVar::SoapVar(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
956+
/* {{{ proto object SoapVar::__construct(mixed data, int encoding [, string type_name [, string type_namespace [, string node_name [, string node_namespace]]]])
959957
SoapVar constructor */
960-
PHP_METHOD(SoapVar, SoapVar)
958+
PHP_METHOD(SoapVar, __construct)
961959
{
962960
zval *data, *type, *this_ptr;
963961
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
@@ -1102,9 +1100,9 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht) /* {{{ */
11021100
}
11031101
/* }}} */
11041102

1105-
/* {{{ proto object SoapServer::SoapServer(mixed wsdl [, array options])
1103+
/* {{{ proto object SoapServer::__construct(mixed wsdl [, array options])
11061104
SoapServer constructor */
1107-
PHP_METHOD(SoapServer, SoapServer)
1105+
PHP_METHOD(SoapServer, __construct)
11081106
{
11091107
soapServicePtr service;
11101108
zval *wsdl = NULL, *options = NULL;
@@ -2256,9 +2254,9 @@ PHP_FUNCTION(is_soap_fault)
22562254

22572255
/* SoapClient functions */
22582256

2259-
/* {{{ proto object SoapClient::SoapClient(mixed wsdl [, array options])
2257+
/* {{{ proto object SoapClient::__construct(mixed wsdl [, array options])
22602258
SoapClient constructor */
2261-
PHP_METHOD(SoapClient, SoapClient)
2259+
PHP_METHOD(SoapClient, __construct)
22622260
{
22632261

22642262
zval *wsdl, *options = NULL;

ext/soap/tests/bug77088.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ catch(SoapFault $e)
1919

2020
?>
2121
--EXPECTF--
22-
Warning: SoapClient::SoapClient() expects parameter 2 to be array, null given in %sbug77088.php on line %d
22+
Warning: SoapClient::__construct() expects parameter 2 to be array, null given in %sbug77088.php on line %d
2323
object(SoapFault)#%d (%d) {
2424
["message":protected]=>
25-
string(44) "SoapClient::SoapClient(): Invalid parameters"
25+
string(%d) "SoapClient::__construct(): Invalid parameters"
2626
["string":"Exception":private]=>
2727
string(0) ""
2828
["code":protected]=>
@@ -40,7 +40,7 @@ object(SoapFault)#%d (%d) {
4040
["line"]=>
4141
int(6)
4242
["function"]=>
43-
string(10) "SoapClient"
43+
string(11) "__construct"
4444
["class"]=>
4545
string(10) "SoapClient"
4646
["type"]=>
@@ -57,7 +57,7 @@ object(SoapFault)#%d (%d) {
5757
["previous":"Exception":private]=>
5858
NULL
5959
["faultstring"]=>
60-
string(44) "SoapClient::SoapClient(): Invalid parameters"
60+
string(%d) "SoapClient::__construct(): Invalid parameters"
6161
["faultcode"]=>
6262
string(6) "Client"
6363
["faultcodens"]=>

ext/soap/tests/bugs/bug31755.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ $response= $client->__call('function', array(), null, $header);
1414
print $client->__getLastRequest();
1515
?>
1616
--EXPECTF--
17-
Warning: SoapHeader::SoapHeader(): Invalid namespace in %s on line %d
17+
Warning: SoapHeader::__construct(): Invalid namespace in %s on line %d
1818
<?xml version="1.0" encoding="UTF-8"?>
1919
<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>

ext/soap/tests/fault_warning.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ $fault = new SoapFault(["more-ns", "Sender"], "message"); // two given
1616
echo get_class($fault);
1717
?>
1818
--EXPECTF--
19-
Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
19+
Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
2020

21-
Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
21+
Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
2222
SoapFault
2323
SoapFault
2424

25-
Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
25+
Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
2626

27-
Warning: SoapFault::SoapFault(): Invalid fault code in %s on line %d
27+
Warning: SoapFault::__construct(): Invalid fault code in %s on line %d
2828
SoapFault

0 commit comments

Comments
 (0)