Commit d549c7ba authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #53 in ZP/z-push from...

Merge pull request #53 in ZP/z-push from bugfix/ZP-700-catch-php-fatals-and-log-them-into to develop

* commit '1f468b44':
  ZP-700 Register a fatal handler and log the error message to LOGLEVEL_ERROR. Released under the Affero GNU General Public License (AGPL) version 3.
parents 57437225 1f468b44
...@@ -331,3 +331,25 @@ function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) ...@@ -331,3 +331,25 @@ function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
error_reporting(E_ALL); error_reporting(E_ALL);
set_error_handler("zarafa_error_handler"); set_error_handler("zarafa_error_handler");
function zpush_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 != 8192) {
ZLog::Write(LOGLEVEL_FATAL, sprintf("Fatal error: %s:%d - %s (%s)", $errfile, $errline, $errstr, $errno));
}
}
}
register_shutdown_function("zpush_fatal_handler");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment