diff --git a/app/config/core.php b/app/config/core.php index cf1a0ab44..1674efd33 100644 --- a/app/config/core.php +++ b/app/config/core.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 )); /** diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 72012e554..bd88c5a18 100644 --- a/cake/libs/configure.php +++ b/cake/libs/configure.php @@ -106,6 +106,9 @@ class Configure { 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 @@ class Configure { } 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; }