ZF-4216: Infinite call loop in Zend_Soap_Client
Description
Two days ago i downloaded Release 1.6.0 to test the Zend_Soap_Client. The code
$Options = array( 'soap_version' => SOAP_1_2, 'encoding' => 'ISO-8859-1' ); $Client = new Zend_Soap_Client('../server/soap_test.wsdl', $Options);
$Response = $Client->get_echo('test');
crashed (under XP / Apache 2.2 / PHP5.2.6)
The code
$Client = new SoapClient('../server/soap_test.wsdl', $Options);
$Response = $Client->__call('get_echo', array('test'));
did work.
I found that Zend_Soap_Client_Common::__doRequest(...) was called (on $this->_soapClient member of Zend_Soap_Client), this one called Zend_Soap_Client::_doRequest(...) which again called Zend_Soap_Client_Common::__doRequest(...) (I think, the base call SoapClient::__doRequest(...) was indented?) and so on.
I am not so familar with the architecture to locate the reason for this.
Best regards, Bernd Schuler
From code comments i guess something like this is intended:
1) Add new function _doRequest to Zend_Soap_Client_Common class:
function _doRequest($request, $location, $action, $version, $one_way)
{
if ($one_way == null) {
return parent::__doRequest($request, $location, $action, $version);
} else {
return parent::__doRequest($request, $location, $action, $version, $one_way);
}
}
2) Change Zend_Soap_Client::_doRequest function to:
public function _doRequest(Zend_Soap_Client_Common $client, $request, $location, $action, $version, $one_way = null)
{
// Perform request as is
return $client->_doRequest($request, $location, $action, $version, $one_way);
}
In this way extensions of Zend_Soap_Client can do some work ( in overwriting Zend_Soap_Client:: _doRequest(...) ), before the actual soap call is done. Eliminating Zend_Soap_Client_Common:: __doRequest(...) will undo this, because then SoapClient:: __doRequest(...) will be called immediately.
Best reagrds, Bernd Schuler
call_user_func(array($client, 'SoapClient::__doRequest'), $request, $location, $action, $version);
Cool, i didn't yet know this syntax in PHP to call base methods of extension classes.
Thanks, Bernd Schuler
Comments
Posted by Frank Ruske (fruske) on 2008-09-08T08:46:07.000+0000
http://framework.zend.com/issues/browse/ZF-4152
Posted by Alexander Veremyev (alexander) on 2008-09-10T12:30:20.000+0000
Thanks for the report and detailed problem research!
A bit shoter way to fix: {panel} return $client->__doRequest($request, $location, $action, $version); {panel} ---> {panel} return call_user_func(array($client,'SoapClient::__doRequest'), $request, $location, $action, $version); {panel}
It directly calls necessary method.
Posted by Alexander Veremyev (alexander) on 2008-09-10T12:31:11.000+0000
Fixed