#50762 [NEW]: in WSDL mode Soap Header handler function only being called if defined in WSDL

From: Date: Fri, 15 Jan 2010 10:33:23 +0000
Subject: #50762 [NEW]: in WSDL mode Soap Header handler function only being called if defined in WSDL
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146691@lists.php.net to get a copy of this message
From: mephius at gmail dot com Operating system: Any PHP version: 5.2.12 PHP Bug Type: SOAP related Bug description: in WSDL mode Soap Header handler function only being called if defined in WSDL Description: ------------ While in WSDL mode, SoapServer looks for soap header handler function in the WSDL only. Why one should expose his internal handling methods to WSDL? Suggested simple patch eliminates necessity to describe handle function in WSDL. (but it just fixes symptoms, therefore should be revised) --- soap.c 2009-11-21 21:43:00.000000000 +0200 +++ soap.c.patched 2010-01-15 12:06:55.000000000 +0200 @@ -1705,14 +1705,14 @@ soapHeader *h = header; header = header->next; - if (service->sdl && !h->function && !h->hdr) { +/* if (service->sdl && !h->function && !h->hdr) { if (h->mustUnderstand) { soap_server_fault("MustUnderstand","Header not understood", NULL, NULL, NULL TSRMLS_CC); } else { continue; } } - +*/ 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) && Reproduce code: --------------- WSDL: http://pastebin.com/f7cd32e16 You'll need to adjust soap endpoint to be able to run the code. === Server Code === <?php class testSoap{ private $auth; public function authToken($token){ $this->auth=true; } public function testHeader($param){ return 'header handler ' . ($this->auth ? 'called' : 'not called'); } } $server = new SoapServer('bug.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE)); $server->setObject(new testSoap()); $server->handle(); ?> === Client Code === <?php $cl = new SoapClient('/path/to/bug.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; ?> Expected result: ---------------- client code should echo "header handler called" Actual result: -------------- client code should echoes "header handler not called" -- Edit bug report at http://bugs.php.net/?id=50762&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50762&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50762&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50762&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50762&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50762&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50762&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50762&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50762&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50762&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50762&r=support Expected behavior: http://bugs.php.net/fix.php?id=50762&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50762&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50762&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50762&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50762&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50762&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50762&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50762&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50762&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50762&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50762&r=mysqlcfg

« previous php.bugs (#146691) next »