|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50762 in WSDL mode Soap Header handler function only being called if defined in WSDL
Submitted: 2010-01-15 10:33 UTC Modified: 2010-05-28 12:54 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: mephius at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.2.12 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mephius at gmail dot com
New email:
PHP Version: OS:


 [2010-01-15 10:33 UTC] mephius at gmail dot com
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 {
                        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:

You'll need to adjust soap endpoint to be able to run the code.

=== Server Code ===
class testSoap{
	private $auth;
	public function authToken($token){
	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());

=== Client Code ===


$cl = new SoapClient('/path/to/bug.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true));

class authToken{
	public function __construct($token){

$cl->__setSoapHeaders(array(new SoapHeader('', '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"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-15 10:36 UTC] mephius at gmail dot com
May be linked to bug #49530
 [2010-05-28 12:52 UTC]
Automatic comment from SVN on behalf of dmitry
Log: Fixed bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL). (mephius at gmail dot com)
 [2010-05-28 12:54 UTC]
-Status: Assigned +Status: Closed
 [2010-05-28 12:54 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 18:01:30 2024 UTC