Zend Framework

Infinite call loop in Zend_Soap_Client

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.6.0
  • Fix Version/s: 1.6.1
  • Component/s: Zend_Soap_Client
  • Labels:
    None

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

Issue Links

Activity

Hide
Alexander Veremyev added a comment -

Thanks for the report and detailed problem research!

A bit shoter way to fix:

return $client->__doRequest($request, $location, $action, $version);

--->

return call_user_func(array($client,'SoapClient::__doRequest'), $request, $location, $action, $version);

It directly calls necessary method.

Show
Alexander Veremyev added a comment - Thanks for the report and detailed problem research! A bit shoter way to fix:
return $client->__doRequest($request, $location, $action, $version);
--->
return call_user_func(array($client,'SoapClient::__doRequest'), $request, $location, $action, $version);
It directly calls necessary method.
Hide
Alexander Veremyev added a comment -

Fixed

Show
Alexander Veremyev added a comment - Fixed

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: