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.
This commit is contained in:
mark_story 2012-12-27 20:58:27 -05:00
parent 604898ad0b
commit 2ba117eeda

View file

@ -272,10 +272,11 @@ class ExceptionRenderer {
$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');