ZF-5586: Extend Zend_Soap_Server and overwrite method "_initializeSoapErrorContext" and error_handler with E_ALL -> "loadXML()" error

Issue Type: Bug Created: 2009-01-20T04:47:43.000+0000 Last Updated: 2009-03-31T20:28:51.000+0000 Status: Resolved Fix version(s): - 1.7.4 (02/Feb/09)

Reporter: Sven (sunnysven) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Soap_Server

Related issues: Attachments:


A small excerpt from my code (overwrite standard error_handler from Zend_Soap_Server:

<pre class="highlight">
class Ms_Soap_Server extends Zend_Soap_Server
    protected function _initializeSoapErrorContext()
        $displayErrorsOriginalState = ini_get('display_errors');
        ini_set('display_errors', false);
        //  Standard = E_USER_ERROR
        set_error_handler(array($this, 'handlePhpErrors'), E_ALL);
        return $displayErrorsOriginalState;
    public function handlePhpErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null) 
        switch ($errno)
            case E_USER_ERROR:
                $soapErrorCode = 'Receiver';
                $errstr = 'Sorry, internal server error!';
                $soapErrorCode = 'Server';
        throw $this->fault($errstr, $soapErrorCode);

When I make an "empty request" to the SoapServer via a web browser ( the answer must be an XML document with an SoapFault "Invalid XML". But that is not possible because of the code beginning on line 612 (SVN)

<pre class="highlight">if (!$dom->loadXML($xml)) {
    require_once 'Zend/Soap/Server/Exception.php';
    throw new Zend_Soap_Server_Exception('Invalid XML');

See DOMDocument::loadXML: "Errors/Exceptions: If an empty string is passed as the source, a warning will be generated."

Before the "loadXML" is called, it should be checked for an empty XML-Document (request) as follows:

<pre class="highlight">
if ($xml == '' || !$dom->loadXML($xml)) {
    require_once 'Zend/Soap/Server/Exception.php';
    throw new Zend_Soap_Server_Exception('Invalid XML');

So it works smoothly when I overwrite the error handler of the Zend_Soap_Server class to return individual error messages for example when a database connetection is impossible -> SoapFault: Sorry, internal server error.

In addition, the word "Reciever" in the class Zend_Soap_Server" should be replaced with "Receiver" (at line 832, 851, 873).


Posted by Benjamin Eberlei (beberlei) on 2009-01-21T02:10:49.000+0000

Issue resolved, will be released in next minor release.

Posted by Benjamin Eberlei (beberlei) on 2009-01-29T11:37:36.000+0000

Moved to 1.7 release branch

Posted by old of Satoru Yoshida ( on 2009-03-31T20:28:50.000+0000

correct fix version

Have you found an issue?

See the Overview section for more details.


© 2006-2022 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.