Permalink
Browse files

Handle MissingViewExceptions better.

When Router::parseExtensions() is enabled for a file extension
that does not map to a view an infinite loop of attempting to render
View/$ext/error500.ctp will be entered. When catching
a MissingViewException check if we were trying to render an
error500. If we were, revert to safe rendering as we might enter a loop.
  • Loading branch information...
1 parent 604898a commit 2ba117eeda6e0ad78916575911748add40a40d5d @markstory markstory committed Dec 28, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/Cake/Error/ExceptionRenderer.php
@@ -272,10 +272,11 @@ protected function _outputMessage($template) {
$this->controller->afterFilter();
$this->controller->response->send();
} catch (MissingViewException $e) {
- try {
- $this->_outputMessage('error500');
- } catch (Exception $e) {
+ $attributes = $e->getAttributes();
+ if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) {
$this->_outputMessageSafe('error500');
+ } else {
+ $this->_outputMessage('error500');
}
} catch (Exception $e) {
$this->_outputMessageSafe('error500');

0 comments on commit 2ba117e

Please sign in to comment.