In CLI mode default the error handlers to Console flavors.

In the somewhat rare case where an error or exception occurs during
application bootstrap, we should not emit HTML to the stdout.

Refs #7661
This commit is contained in:
mark_story 2015-11-09 21:47:16 -05:00
parent df3c786f57
commit 89d5449270

View file

@ -87,6 +87,12 @@ class Configure {
'handler' => 'ErrorHandler::handleError', 'handler' => 'ErrorHandler::handleError',
'level' => E_ALL & ~E_DEPRECATED, 'level' => E_ALL & ~E_DEPRECATED,
); );
if (PHP_SAPI === 'cli') {
App::uses('ConsoleErrorHandler', 'Console');
$console = new ConsoleErrorHandler();
$exception['handler'] = array($console, 'handleException');
$error['handler'] = array($console, 'handleError');
}
static::_setErrorHandlers($error, $exception); static::_setErrorHandlers($error, $exception);
if (!include APP . 'Config' . DS . 'bootstrap.php') { if (!include APP . 'Config' . DS . 'bootstrap.php') {