- var_dump: documentation ( source)
- set_exception_handler: documentation ( source)
<?php
/*set_exception_handler(function ($e) {
var_dump($e->getMessage());
throw 1;
});*/
function unhandled(Exception $e)
{
// set dummy handler and return previous handler
$handler = set_exception_handler(function ($e) {
var_dump($e);
throw 1;
});
// use dummy handler when no original handler is available
if ($handler === null) {
$handler = set_exception_handler(null);
}
set_exception_handler(null);
try {
$handler($e);
} catch (Exception $e) {
var_dump('foo', $e);
}
echo 'die';
die(255);
}
echo 1;
unhandled(new RuntimeException('fatal error'));
echo 2;