From: Dmitry Stogov Date: Fri, 28 May 2010 10:52:16 +0000 (+0000) Subject: Fixed bug #50762 (in WSDL mode Soap Header handler function only being called if... X-Git-Tag: php-5.2.14RC1~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c554397e1a5a2a347cf339e119933cce0229425b;p=php Fixed bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL). (mephius at gmail dot com) --- diff --git a/NEWS b/NEWS index ef6105ce52..20391a283b 100644 --- a/NEWS +++ b/NEWS @@ -65,6 +65,8 @@ PHP NEWS - Fixed bug #51062 (DBA DB4 uses mismatched headers and libraries). (Chris Jones) - Fixed bug #51023 (filter doesn't detect int overflows with GCC 4.4). (Raphael Geissert) +- Fixed bug #50762 (in WSDL mode Soap Header handler function only being called + if defined in WSDL). (mephius at gmail dot com) - Fixed bug #50698 (SoapClient should handle wsdls with some incompatiable endpoints). (Justin Dearing) - Fixed bug #50383 (Exceptions thrown in __call() / __callStatic() do not diff --git a/ext/soap/soap.c b/ext/soap/soap.c index ed1ec51aa6..aafc761ee5 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1706,6 +1706,7 @@ PHP_METHOD(SoapServer, handle) soapHeader *h = header; header = header->next; +#if 0 if (service->sdl && !h->function && !h->hdr) { if (h->mustUnderstand) { soap_server_fault("MustUnderstand","Header not understood", NULL, NULL, NULL TSRMLS_CC); @@ -1713,7 +1714,7 @@ PHP_METHOD(SoapServer, handle) continue; } } - +#endif fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name)); if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) + 1) || ((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) && diff --git a/ext/soap/tests/bugs/bug50762.phpt b/ext/soap/tests/bugs/bug50762.phpt new file mode 100644 index 0000000000..f9099f1ac1 --- /dev/null +++ b/ext/soap/tests/bugs/bug50762.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL) +--FILE-- +auth=true; + } + public function testHeader($param){ + return 'header handler ' . ($this->auth ? 'called' : 'not called'); + } +} + +class LocalSoapClient extends SoapClient { + + function __construct($wsdl, $options) { + parent::__construct($wsdl, $options); + $this->server = new SoapServer($wsdl, $options); + $this->server->setObject(new testSoap()); + } + + function __doRequest($request, $location, $action, $version, $one_way = 0) { + ob_start(); + $this->server->handle($request); + $response = ob_get_contents(); + ob_end_clean(); + return $response; + } + +} + +$cl = new LocalSoapClient(dirname(__FILE__).'/bug50762.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true)); + +class authToken{ + public function __construct($token){ + $this->authToken=$token; + } +} + +$cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/', 'authToken', new authToken('tokendata')))); +echo $cl->testHeader('param') . PHP_EOL; +?> +--EXPECT-- +header handler called diff --git a/ext/soap/tests/bugs/bug50762.wsdl b/ext/soap/tests/bugs/bug50762.wsdl new file mode 100644 index 0000000000..2980589acb --- /dev/null +++ b/ext/soap/tests/bugs/bug50762.wsdl @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +