ZF-12393: SoapFault returning is not in XML format


I'm not sure when this broke, but after a recent upgrade to ZF 1.12.0 I tried my Zend_Soap_Server service again using SoapUI, and found that when an exception is thrown I'm getting a response like this:

HTTP/1.1 200 OK
Date: Thu, 30 Aug 2012 02:48:31 GMT
Server: Apache/2.2.16 (Win32) mod_ssl/2.2.16 OpenSSL/0.9.8o
X-Powered-By: PHP/5.3.8-ZS5.5.0 ZendServer
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
Set-Cookie: PHPSESSID=ujk8qs9d6f4lb8e1k2028dv3s4; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8

SoapFault exception: [Receiver] Your account is currently locked out for 15 minutes. in C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Soap\Server.php:1001
Stack trace:
#0 C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Soap\Server.php(888): Zend_Soap_Server->fault(Object(Api_Exception))
#1 C:\Development\accord\application\modules\api\controllers\SoapController.php(41): Zend_Soap_Server->handle()
#2 C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Action.php(516): Api_SoapController->serviceAction()
#3 C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Dispatcher\Standard.php(308): Zend_Controller_Action->dispatch('serviceAction')
#4 C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#5 C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#6 C:\Program Files\Zend\ZendServer\share\ZendFramework\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#7 C:\Development\accord\public\index.php(30): Zend_Application->run()
#8 {main}

This is happening because in line 903 of Zend_Soap_Server.php, it has this:

        if (!$this->_returnResponse) {
            echo $this->_response;

Just echoing the response (which in this case is a SoapFault) does NOT give an XML rendering compatible with the SOAP protocol. It looks like you'd need to go $soap->fault(faultCode, faultMessage) instead...


PHP 5.3.8

Guys, this was broken in this exact commit, for 1.11:


Surely this is critical!?!?

The code is assuming that going 'echo SoapFault object' is the same as going 'SoapServer->fault()' - which it is not!

Patch for this issue?

Hello, to make a quick fix i do this : in Zend_Soap_Server, around line 899 I change this :

        if ($fault) {
            $this->_response = $fault;

to this

        if ($fault) {
            $soap->fault($fault->faultcode, $fault->faultstring);

Fixed on trunk (25176) and release-1.12 (25177)