Re: [SOAP] Custom Error-Handling

From: Date: Wed, 28 Jan 2004 02:13:06 +0000
Subject: Re: [SOAP] Custom Error-Handling
References: 1 2 3  Groups: php.pear.general php.soap 
Request: Send a blank email to pear-general+get-10395@lists.php.net to get a copy of this message
Martin Hesse wrote:
Mike Carter wrote: 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 That doesnt help ALL errors get sent to the error_handler, regardless of the error_Reporting level
I think the best bet may be something like: // @ return 0 for error_repporting // and this checks the general error_reporting level... if (!(ini_get ('error_reporting') & $errno)) { return; } .. now report it..
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.
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

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