diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 87c3c6e02..40c27cc15 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -160,9 +160,11 @@ class ShellDispatcher { $errorHandler = new ConsoleErrorHandler(); if (empty($error['consoleHandler'])) { $error['consoleHandler'] = array($errorHandler, 'handleError'); + Configure::write('error', $error); } if (empty($exception['consoleHandler'])) { $exception['consoleHandler'] = array($errorHandler, 'handleException'); + Configure::write('exception', $exception); } set_exception_handler($exception['consoleHandler']); set_error_handler($error['consoleHandler'], Configure::read('Error.level')); diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 01e0d1ae6..071faa7a6 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -913,7 +913,11 @@ class App { return; } - $errorHandler = Configure::read('Error.handler'); + if (PHP_SAPI === 'cli') { + $errorHandler = Configure::read('Error.consoleHandler'); + } else { + $errorHandler = Configure::read('Error.handler'); + } if (!is_callable($errorHandler)) { return; }