Skip to content

Instantly share code, notes, and snippets.

@uuf6429
Last active December 24, 2015 00:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uuf6429/6719756 to your computer and use it in GitHub Desktop.
Save uuf6429/6719756 to your computer and use it in GitHub Desktop.
PHP Post-Mortem Tool
<?php
function on_shutdown(){
global $php_errormsg;
echo "<!--\n";
echo "\n\tHeaders Sent:";
$file = $line = null;
headers_sent($file, $line);
echo "\n\t\t$file: $line";
echo "\n\tLast Error:";
if(function_exists('error_get_last') && error_get_last())
foreach(error_get_last() as $k => $v)
echo "\n\t\t$k: $v";
elseif(isset($php_errormsg) && $php_errormsg)
echo "\n\t\tError: $php_errormsg";
else echo "\n\t\tnone";
echo "\n\tIncluded Files:";
echo "\n\t\t".implode("\n\t\t", get_included_files());
echo "\n-->";
}
register_shutdown_function('on_shutdown');
while(ob_get_level())ob_end_clean();
ob_implicit_flush(true);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment