Created
October 24, 2013 18:43
-
-
Save adamlutz/7142751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debug_string_backtrace() { | |
$output = ''; | |
$backtrace = debug_backtrace(); | |
foreach($backtrace as $key => $item) { | |
$output .= "\r\n item $key ".$item['file']." [".$item['line']."] ".$item['function']; | |
} | |
return $output; | |
} | |
error_reporting(E_ERROR); | |
function fatal_handler() { | |
// $errfile = "unknown file"; | |
// $errstr = "shutdown"; | |
// $errno = E_CORE_ERROR; | |
// $errline = 0; | |
$error = error_get_last(); | |
if( $error !== NULL && $error['type'] == E_ERROR) { | |
$errno = $error["type"]; | |
$errfile = $error["file"]; | |
$errline = $error["line"]; | |
$errstr = $error["message"]; | |
error_log("TRAPPED --> $errno $errfile $errline $errstr"); | |
error_log( debug_string_backtrace() ); // | |
// error_log( implode(" ** ", debug_backtrace( false )) ); | |
} | |
//exit(0); | |
//error_mail( format_error( $errno, $errstr, $errfile, $errline ) ); | |
} | |
register_shutdown_function( "fatal_handler" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment