So in php.ini I've set:
error_reporting  =  E_ERROR
and I've written a handler:
register_shutdown_function( "fatal_handler" );
function fatal_handler() {
  $errfile = "unknown file";
  $errstr  = "shutdown";
  $errno   = E_CORE_ERROR;
  $errline = 0;
  $error = error_get_last();
  if( $error !== NULL) {
    $errno   = $error["type"];
    $errfile = $error["file"];
    $errline = $error["line"];
    $errstr  = $error["message"];
    if($errno == E_ERROR){
      $html = 'some html here';
      print($html);
      die();
    }
  }
}
What I did to test it is put a sleep longer than the max_execution_time in one script. For some reason this also kills other pages if I open up a new one in a different tab while loading the intentionally broken one. That's fine, whatever, but when the second page crashes, it's giving me a warning for error_get_last(). But I set error_reporting to 1! Why is it showing me a warning? It doesn't log it, but it causes me to fail to catch the error resulting a white screen, the exact thing this code is supposed to avoid!