Re: Custom Error-Handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux