JustHere is just a nice trick to get the current error_handler method =)
<?php
register_shutdown_function('__fatalHandler');
function __fatalHandler()
{
$error $error = error_get_last();
//check Check if it's a core/fatal error,. otherwiseOtherwise, it's a normal shutdown
if($error !== NULL && $error['type'] === E_ERROR) {
//Bit It is a bit hackish, but the set_exception_handler
// will return the old handler
function fakeHandler() { }
$handler = set_exception_handler('fakeHandler');
restore_exception_handler();
if($handler !== null) {
call_user_func(
$handler,
new ErrorException(
$error['message'],
$error['type'],
0,
$error['file'],
$error['line']));
}
exit;
}
}
?>
Also i wan'tI want to note that if you call
<?php
ini_set('display_errors', false);
?>
PhpPHP stops displaying the error. Otherwise, otherwise the error text will be send to the client prior to your error handler.