Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit b64b1219c4ebc8c46d51d8a35c8ef0ed85a16acd 1 parent 5fd1926
@markstory markstory authored
Showing with 10 additions and 5 deletions.
  1. +5 −1 cake/libs/cake_log.php
  2. +5 −4 cake/libs/configure.php
View
6 cake/libs/cake_log.php
@@ -288,5 +288,9 @@ function handleError($code, $description, $file = null, $line = null, $context =
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
9 cake/libs/configure.php
@@ -123,14 +123,15 @@ function write($config, $value = null) {
}
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 @@ function __destruct() {
Cache::write('object_map', $this->__objects, '_cake_core_');
}
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.