[SOAP] Custom Error-Handling (was: Re: [PEAR] [DB_DataObject])

From: Date: Tue, 27 Jan 2004 14:01:21 +0000
Subject: [SOAP] Custom Error-Handling (was: Re: [PEAR] [DB_DataObject])
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10383@lists.php.net to get a copy of this message
Mike Carter wrote:
About this time last year I was also suffering from a similar problem. I spent so long banging my head that in the end I gave up and the management turned the SOAP server side over to .net to save further development time :-( Sorry I can't offer anything more in the way of help. Would be interested to find out why it occurs; it made no sense to me!
It seems, that the callback error handler, that is set on line 264 in SOAP/Server.php returns a SOAP_Fault on every Error/Warning/Notice that occurs (Missing indexes would be a notice I think). There are two solutions to avoid this bevaviour: a.) change the error_reporting level of your script or b.) modify the function SOAP_ServerErrorHandler that handles the errors in SOAP/Server.php to only set soap_server_fault to SOAP_Fault when the error number passed to the callback-function is E_USER_ERROR or E_USER_WARNING. [CODE] define("FATAL", E_USER_ERROR); define("ERROR", E_USER_WARNING); define("WARNING", E_USER_NOTICE); $soap_server_fault = null; function SOAP_ServerErrorHandler($errno, $errmsg, $filename, $linenum, $vars) {
    	global $soap_server_fault;
        switch($errno) {
                case FATAL:
                case ERROR:
                        $detail = "Errno: $errno\nFilename: $filename\nLineno: $linenum\n";
                        // XXX very strange behaviour with error handling if we =& here.
                        $soap_server_fault = new SOAP_Fault($errmsg, 'Server', 'PHP', $detail);
                        break;
                case WARNING:
                default:
                        break;
        }
} [/CODE] Cheers.

« previous php.pear.general (#10383) next »