Commit 0b72fe9f authored by Ralf Becker's avatar Ralf Becker

ZP-711 zpush_fatal_handler reports PHP Notice & Warning as FATAL in...

ZP-711 zpush_fatal_handler reports PHP Notice & Warning as FATAL in z-plush(-error).log. Released under the Affero GNU General Public License (AGPL) version 3.
parent ba460f57
...@@ -300,11 +300,14 @@ function debugLog($message) { ...@@ -300,11 +300,14 @@ function debugLog($message) {
ZLog::Write(LOGLEVEL_DEBUG, $message); ZLog::Write(LOGLEVEL_DEBUG, $message);
} }
// E_DEPRECATED only available since PHP 5.3.0
if (!defined('E_DEPRECATED')) define(E_DEPRECATED, 8192);
// TODO review error handler // TODO review error handler
function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) { function zarafa_error_handler($errno, $errstr, $errfile, $errline, $errcontext) {
$bt = debug_backtrace(); $bt = debug_backtrace();
switch ($errno) { switch ($errno) {
case 8192: // E_DEPRECATED since PHP 5.3.0 case E_DEPRECATED:
// do not handle this message // do not handle this message
break; break;
...@@ -347,7 +350,8 @@ function zpush_fatal_handler() { ...@@ -347,7 +350,8 @@ function zpush_fatal_handler() {
$errline = $error["line"]; $errline = $error["line"];
$errstr = $error["message"]; $errstr = $error["message"];
if ($errno != 8192) { // do NOT log PHP Notice, Warning or Deprecated as FATAL
if ($errno & ~(E_NOTICE|E_WARNING|E_DEPRECATED)) {
ZLog::Write(LOGLEVEL_FATAL, sprintf("Fatal error: %s:%d - %s (%s)", $errfile, $errline, $errstr, $errno)); ZLog::Write(LOGLEVEL_FATAL, sprintf("Fatal error: %s:%d - %s (%s)", $errfile, $errline, $errstr, $errno));
} }
} }
......
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