Only try to use CakeErrorController if AppController exists.

This fixes missing error pages when there are parse errors in
AppController.

Fixes #3850
This commit is contained in:
mark_story 2013-05-26 22:11:13 -04:00
parent 76f4d10d13
commit 41e0c524f2

View file

@ -151,12 +151,14 @@ class ExceptionRenderer {
$response->header($exception->responseHeader()); $response->header($exception->responseHeader());
} }
try { if (class_exists('AppController')) {
$controller = new CakeErrorController($request, $response); try {
$controller->startupProcess(); $controller = new CakeErrorController($request, $response);
} catch (Exception $e) { $controller->startupProcess();
if (!empty($controller) && $controller->Components->enabled('RequestHandler')) { } catch (Exception $e) {
$controller->RequestHandler->startup($controller); if (!empty($controller) && $controller->Components->enabled('RequestHandler')) {
$controller->RequestHandler->startup($controller);
}
} }
} }
if (empty($controller)) { if (empty($controller)) {