From 42d25dc2b25273caac32dfff218a1b85b05d3ba1 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 28 May 2010 10:52:16 +0000 Subject: Fixed bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL). (mephius at gmail dot com) --- NEWS | 2 ++ ext/soap/soap.c | 3 ++- ext/soap/tests/bugs/bug50762.phpt | 45 +++++++++++++++++++++++++++++++++++++++ ext/soap/tests/bugs/bug50762.wsdl | 36 +++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 ext/soap/tests/bugs/bug50762.phpt create mode 100644 ext/soap/tests/bugs/bug50762.wsdl diff --git a/NEWS b/NEWS index 8f737c53b2..2662a43be5 100644 --- a/NEWS +++ b/NEWS @@ -152,6 +152,8 @@ PHP NEWS - Fixed bug #50999 (unaligned memory access in dba_fetch()). (Felipe) - Fixed bug #50828 (DOMNotation is not subclass of DOMNode). (Rob) - Fixed bug #50810 (property_exists does not work for private). (Felipe) +- Fixed bug #50762 (in WSDL mode Soap Header handler function only being called + if defined in WSDL). (mephius at gmail dot com) - Fixed bug #50731 (Inconsistent namespaces sent to functions registered with spl_autoload_register). (Felipe) - Fixed bug #50555 (DateTime::sub() allows 'relative' time modifications). (Derick) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 00fe814db5..2edda30ec7 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1874,6 +1874,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); @@ -1881,7 +1882,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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1