Skip to content
Permalink
Browse files

Adding level to the core.php file, this lets you choose which error l…

…evels you are interested in for your application.

Removing hardcoded error_reporting levels in Configure.
  • Loading branch information...
markstory committed Nov 15, 2010
1 parent 561fe7b commit a621ac1ba3d3e819c772312713fb47b03b1c278d
Showing with 14 additions and 9 deletions.
  1. +7 −2 app/config/core.php
  2. +7 −7 cake/libs/configure.php
@@ -53,11 +53,16 @@
/**
* Configure the Error handler used to handle errors for your application. By default
* ErrorHandler::handleError() is used. It will display errors using Debugger, when debug > 0
* and log errors with CakeLog when debug = 0. You can set it to any static method that is built to handle
* errors.
* and log errors with CakeLog when debug = 0.
*
* Options:
*
* - `handler` The callback to handle errors. You can set this to any callback type, including anonymous functions.
* - `level` The level of errors you are interested in capturing.
*/
Configure::write('Error', array(
'handler' => 'ErrorHandler::handleError',
'level' => E_ALL & ~E_DEPRECATED
));
/**
@@ -106,6 +106,9 @@ public static function bootstrap($boot = true) {
if (!empty(self::$_values['Error']['handler'])) {
set_error_handler(self::$_values['Error']['handler']);
}
if (isset(self::$_values['Error']['level'])) {
error_reporting(self::$_values['Error']['level']);
}
if (!empty(self::$_values['Exception']['handler'])) {
set_exception_handler(self::$_values['Exception']['handler']);
}
@@ -164,16 +167,13 @@ public static function write($config, $value = null) {
}
if (isset($config['debug']) || isset($config['log'])) {
$reporting = 0;
if (self::$_values['debug']) {
$reporting = E_ALL & ~E_DEPRECATED;
if (function_exists('ini_set')) {
if (function_exists('ini_set')) {
if (self::$_values['debug']) {
ini_set('display_errors', 1);
} else {
ini_set('display_errors', 0);
}
} elseif (function_exists('ini_set')) {
ini_set('display_errors', 0);
}
error_reporting($reporting);
}
return true;
}

0 comments on commit a621ac1

Please sign in to comment.
You can’t perform that action at this time.