I set a set_exception_handler and a set_error_handler to properly handle exceptions and errors, still those do not catch 'fatal error'.
I tried this:
register_shutdown_function( "fatal_handler" );
function fatal_handler()
{
FlashMessages::flashIt( 'message', 'Fatal error' );
include( Settings::ABSPATH . '/src/views/message.php' );
$error = error_get_last();
if ( $error !== null ) {
$errno = $error[ "type" ];
$errfile = $error[ "file" ];
$errline = $error[ "line" ];
$errstr = $error[ "message" ];
var_dump( $error );
}
}
and i'm indeed able to dump the error, but there is no way to avoid the full stack error on top of page. How could I avoid displaying the error stack ?