Adding missed isset() check

Making ConsoleErrorHandler handle both errors, and exceptions in CLI.
This commit is contained in:
mark_story 2010-11-14 22:48:13 -05:00
parent 74bf455c49
commit 14a6368b39
2 changed files with 5 additions and 3 deletions

View file

@ -141,13 +141,15 @@ class ShellDispatcher {
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php'); $boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php');
require CORE_PATH . 'cake' . DS . 'bootstrap.php'; require CORE_PATH . 'cake' . DS . 'bootstrap.php';
require_once CONSOLE_LIBS . 'console_error_handler.php';
set_exception_handler(array('ConsoleErrorHandler', 'handleException'));
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) { if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
include_once CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php'; include_once CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
App::build(); App::build();
} }
require_once CONSOLE_LIBS . 'console_error_handler.php';
set_exception_handler(array('ConsoleErrorHandler', 'handleException'));
set_error_handler(array('ConsoleErrorHandler', 'handleError'));
if (!defined('FULL_BASE_URL')) { if (!defined('FULL_BASE_URL')) {
define('FULL_BASE_URL', '/'); define('FULL_BASE_URL', '/');
} }

View file

@ -93,7 +93,7 @@ class ErrorHandler {
*/ */
public static function handleError($code, $description, $file = null, $line = null, $context = null) { public static function handleError($code, $description, $file = null, $line = null, $context = null) {
$errorConfig = Configure::read('Error'); $errorConfig = Configure::read('Error');
if ($errorConfig['level'] && ($code & ~$errorConfig['level'])) { if (isset($errorConfig['level']) && ($code & ~$errorConfig['level'])) {
return; return;
} }
list($error, $log) = self::_mapErrorCode($code); list($error, $log) = self::_mapErrorCode($code);