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
This commit is contained in:
mark_story 2011-05-28 13:59:56 -04:00
parent 5fd19266ba
commit b64b1219c4
2 changed files with 10 additions and 5 deletions

View file

@ -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'));
}
}

View file

@ -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);
}