From 0e0c37bc3b8e46d9ecc89fd5591e6b258ebd8b74 Mon Sep 17 00:00:00 2001 From: Francesco Negri Date: Sat, 4 Aug 2012 14:16:50 +0300 Subject: Logging should obey error_reporting() setting If the php error level is not included in the current error_reporting() setting, we should not log it. Also, the log_threshold check is redundant, it's already taken care of by the write_log() method. --- system/core/Common.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index 57374b07d..cb99d0505 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -524,21 +524,20 @@ if ( ! function_exists('_exception_handler')) { $_error =& load_class('Exceptions', 'core'); - // Should we display the error? We'll get the current error_reporting + // Should we ignore the error? We'll get the current error_reporting // level and add its bits with the severity bits to find out. - // And respect display_errors - if (($severity & error_reporting()) === $severity && (bool) ini_get('display_errors') === TRUE) + if (($severity & error_reporting()) !== $severity) + { + return; + } + + // Should we display the error? + if ((bool) ini_get('display_errors') === TRUE) { $_error->show_php_error($severity, $message, $filepath, $line); } - // Should we log the error? No? We're done... - if (config_item('log_threshold') === 0) - { - return; - } - - $_error->log_exception($severity, $message, $filepath, $line); + $_error->log_exception($severity, $message, $filepath, $line); } } -- cgit v1.2.3-24-g4f1b From 312bdc5e2160784c7fdd0f38c6d417a9eb5babe0 Mon Sep 17 00:00:00 2001 From: Francesco Negri Date: Sat, 4 Aug 2012 07:32:19 -0400 Subject: fixed whitespace --- system/core/Common.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'system/core/Common.php') diff --git a/system/core/Common.php b/system/core/Common.php index cb99d0505..32c8bd68d 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -527,17 +527,17 @@ if ( ! function_exists('_exception_handler')) // Should we ignore the error? We'll get the current error_reporting // level and add its bits with the severity bits to find out. if (($severity & error_reporting()) !== $severity) - { - return; - } - - // Should we display the error? - if ((bool) ini_get('display_errors') === TRUE) + { + return; + } + + // Should we display the error? + if ((bool) ini_get('display_errors') === TRUE) { $_error->show_php_error($severity, $message, $filepath, $line); } - $_error->log_exception($severity, $message, $filepath, $line); + $_error->log_exception($severity, $message, $filepath, $line); } } -- cgit v1.2.3-24-g4f1b