public static isFatalError ( array $error ) : boolean | ||
$error | array | error got from error_get_last() |
return | boolean | if error is one of fatal type |
public static function isFatalError($error)
{
return isset($error['type']) && in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING));
}
/** * PHP shutdown function used to catch fatal errors. * This method should be registered as PHP error handler using * {@link register_shutdown_function}. The method throws an exception that * contains the error information. */ public static function phpFatalErrorHandler() { $error = error_get_last(); if ($error && TPhpErrorException::isFatalError($error) && error_reporting() & $error['type']) { self::exceptionHandler(new TPhpErrorException($error['type'], $error['message'], $error['file'], $error['line'])); } }