From 2ba117eeda6e0ad78916575911748add40a40d5d Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 27 Dec 2012 20:58:27 -0500 Subject: [PATCH] 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. --- lib/Cake/Error/ExceptionRenderer.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index b315a36cd..2ee473221 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -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');