function bh_fatal_error_handler() { if (($error = error_get_last()) === null) { return; } if (!in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) { return; } $exception = new Error($error['message'], 0, $error['type'], $error['file'], $error['line']); bh_exception_handler($exception); }
function bh_shutdown_handler() { if (($error = error_get_last()) && $error['type'] == E_ERROR) { bh_exception_handler(new Error($error['message'], 0, $error['type'], $error['file'], $error['line'])); } }