Skip to content

Instantly share code, notes, and snippets.

@alexweissman
Created April 26, 2016 19:37
Show Gist options
  • Select an option

  • Save alexweissman/bf9931dcd1ee7341eec7e683ec834dff to your computer and use it in GitHub Desktop.

Select an option

Save alexweissman/bf9931dcd1ee7341eec7e683ec834dff to your computer and use it in GitHub Desktop.
public function fatalHandler() {
$error = error_get_last();
// Handle fatal errors
if( $error !== NULL && $error['type'] == E_ERROR) {
$errno = $error["type"];
$errfile = $error["file"];
$errline = $error["line"];
$errstr = $error["message"];
// Inform the client of a fatal error
if ($this->alerts && is_object($this->alerts) && $this->translator)
$this->alerts->addMessageTranslated("danger", "SERVER_ERROR");
error_log("Fatal error ($errno) in $errfile on line $errline: $errstr");
header("HTTP/1.1 500 Internal Server Error");
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment