Permalink
Browse files

Fixing how error handlers are registered when debug levels

are toggled mid request.  Previously Debugger would stay
as the active error handler even after changing debug to 0.
Now, either CakeLog or Debugger will be assigned as the error handler
depending on the debug level.
Fixes #1941
  • Loading branch information...
1 parent aee650d commit fdc006a2e3a0686f4050b5bed7cbaf096e77e1f3 @markstory markstory committed Aug 27, 2011
Showing with 7 additions and 0 deletions.
  1. +7 −0 cake/libs/configure.php
View
@@ -118,6 +118,7 @@ function write($config, $value = null) {
if (function_exists('ini_set')) {
ini_set('display_errors', 1);
}
+ $callback = array('Debugger', 'getInstance');
} elseif (function_exists('ini_set')) {
ini_set('display_errors', 0);
}
@@ -132,6 +133,12 @@ function write($config, $value = null) {
if (!class_exists('CakeLog')) {
require LIBS . 'cake_log.php';
}
+ if (empty($callback)) {
+ $callback = array('CakeLog', 'getInstance');
+ }
+ }
+ if (!empty($callback) && class_exists('Debugger')) {
+ Debugger::invoke(call_user_func($callback));
}
error_reporting($reporting);
}

0 comments on commit fdc006a

Please sign in to comment.