From c69f799422df7dd85836411875f7090181ff785c Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Sat, 8 Jun 2013 10:17:56 +0200 Subject: [PATCH 1/2] Copy the static $errorPriorityMap to a scoped variable with the same name and use it within the error/exception handler --- src/Logger.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Logger.php b/src/Logger.php index 436c702b..70827197 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -517,16 +517,16 @@ public static function registerErrorHandler(Logger $logger, $continueNativeHandl return false; } - $errorHandlerMap = static::$errorPriorityMap; + $errorPriorityMap = static::$errorPriorityMap; $previous = set_error_handler(function ($level, $message, $file, $line) - use ($logger, $errorHandlerMap, $continueNativeHandler) + use ($logger, $errorPriorityMap, $continueNativeHandler) { $iniLevel = error_reporting(); if ($iniLevel & $level) { - if (isset(Logger::$errorPriorityMap[$level])) { - $priority = $errorHandlerMap[$level]; + if (isset($errorPriorityMap[$level])) { + $priority = $errorPriorityMap[$level]; } else { $priority = Logger::INFO; } From 549142680502c7a617c5387d9aef17351362221a Mon Sep 17 00:00:00 2001 From: Marc Bennewitz Date: Sat, 8 Jun 2013 10:23:56 +0200 Subject: [PATCH 2/2] fixed 4456: call register[Error|Exception]Handler with static instad of self to make it possible overwrite the methods but using the auto register logger options --- src/Logger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Logger.php b/src/Logger.php index 70827197..0eaff585 100644 --- a/src/Logger.php +++ b/src/Logger.php @@ -147,11 +147,11 @@ public function __construct(array $options = null) } if (isset($options['exceptionhandler']) && $options['exceptionhandler'] === true) { - self::registerExceptionHandler($this); + static::registerExceptionHandler($this); } if (isset($options['errorhandler']) && $options['errorhandler'] === true) { - self::registerErrorHandler($this); + static::registerErrorHandler($this); } }