Skip to content

Instantly share code, notes, and snippets.

@cthos
Created December 15, 2011 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cthos/1482749 to your computer and use it in GitHub Desktop.
Save cthos/1482749 to your computer and use it in GitHub Desktop.
Error Reporting
<?php
error_reporting(0);
set_error_handler('custHandler');
register_shutdown_function('shutdownHandler');
function custHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
echo "Custom handler called.";
}
function shutdownHandler()
{
echo "I died.";
var_dump(error_get_last());
}
$data = '';
while(true) {
$data .= str_repeat('#', PHP_INT_MAX);
}
@cthos
Copy link
Author

cthos commented Dec 15, 2011

php fatal.php
I died.array(4) {
["type"]=>
int(1)
["message"]=>
string(78) "Out of memory (allocated 786432) (tried to allocate 9223372036854775808 bytes)"
["file"]=>
string(40) "/home/alex/Documents/Code/test/fatal.php"
["line"]=>
int(21)
}

@cthos
Copy link
Author

cthos commented Dec 15, 2011

Removing the error_reporting line and changing display_errors to 0 in php.ini yields the same results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment