From b64b1219c4ebc8c46d51d8a35c8ef0ed85a16acd Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 28 May 2011 13:59:56 -0400 Subject: [PATCH] Fixing CakeLog::handleError() being called too often. Adding a PHP5 conditional, so custom error handlers are not called for errors not in the configured masking. Fixes #1735 --- cake/libs/cake_log.php | 6 +++++- cake/libs/configure.php | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cake/libs/cake_log.php b/cake/libs/cake_log.php index 1d92ad854..c9f41d296 100644 --- a/cake/libs/cake_log.php +++ b/cake/libs/cake_log.php @@ -288,5 +288,9 @@ class CakeLog { if (!defined('DISABLE_DEFAULT_ERROR_HANDLING')) { $cakeLog =& CakeLog::getInstance(); - set_error_handler(array($cakeLog, 'handleError')); + if (PHP5) { + set_error_handler(array($cakeLog, 'handleError'), error_reporting()); + } else { + set_error_handler(array($cakeLog, 'handleError')); + } } diff --git a/cake/libs/configure.php b/cake/libs/configure.php index e3e8e7835..82dfe76f4 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -123,14 +123,15 @@ class Configure extends Object { } if (isset($_this->log) && $_this->log) { - if (!class_exists('CakeLog')) { - require LIBS . 'cake_log.php'; - } if (is_integer($_this->log) && !$_this->debug) { $reporting = $_this->log; } else { $reporting = E_ALL & ~E_DEPRECATED; } + error_reporting($reporting); + if (!class_exists('CakeLog')) { + require LIBS . 'cake_log.php'; + } } error_reporting($reporting); } @@ -1317,4 +1318,4 @@ class App extends Object { Cache::write('object_map', $this->__objects, '_cake_core_'); } } -} \ No newline at end of file +}