Permalink
Browse files

Fix error when rendering fatal error page.

If you included parse errors in AppController, the fatal error
page would not correctly display.
  • Loading branch information...
1 parent ef9c5bc commit efe836480bff948897edb77616a0f063bfb0b4c6 @markstory markstory committed May 5, 2012
Showing with 9 additions and 2 deletions.
  1. +4 −1 lib/Cake/Error/ErrorHandler.php
  2. +5 −1 lib/Cake/Error/ExceptionRenderer.php
@@ -204,7 +204,10 @@ public static function handleFatalError($code, $description, $file, $line) {
return false;
}
- ob_clean();
+ if (ob_get_level()) {
+ ob_clean();
+ }
+
if (Configure::read('debug')) {
call_user_func($exceptionHandler, new FatalErrorException($description, 500, $file, $line));
} else {
@@ -147,8 +147,12 @@ protected function _getController($exception) {
}
$response = new CakeResponse(array('charset' => Configure::read('App.encoding')));
try {
- $controller = new CakeErrorController($request, $response);
+ if (class_exists('AppController')) {
+ $controller = new CakeErrorController($request, $response);
+ }
} catch (Exception $e) {
+ }
+ if (empty($controller)) {
$controller = new Controller($request, $response);
$controller->viewPath = 'Errors';
}

0 comments on commit efe8364

Please sign in to comment.