From 7203e25a6609d35effbe81317b4bc171de282aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roaldseth?= Date: Fri, 18 Jan 2013 10:24:37 +0100 Subject: [PATCH 1/2] Update the test case so that it fails if the 404 view is missing the display_exceptions variable when we want to display exceptions. --- tests/ZendTest/Mvc/View/RouteNotFoundStrategyTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/ZendTest/Mvc/View/RouteNotFoundStrategyTest.php b/tests/ZendTest/Mvc/View/RouteNotFoundStrategyTest.php index 6937d153d96..58d0eb299c9 100644 --- a/tests/ZendTest/Mvc/View/RouteNotFoundStrategyTest.php +++ b/tests/ZendTest/Mvc/View/RouteNotFoundStrategyTest.php @@ -223,6 +223,7 @@ public function test404ResponsePrepares404ViewModelWithExceptionWhenAllowed() $this->assertInstanceOf('Zend\View\Model\ModelInterface', $model); $variables = $model->getVariables(); if ($allow) { + $this->assertTrue($variables['display_exceptions']); $this->assertTrue(isset($variables['exception'])); $this->assertSame($exception, $variables['exception']); } else { From a3454dc36a5881fdf83a115b247741b3bd8a238c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roaldseth?= Date: Fri, 18 Jan 2013 10:25:31 +0100 Subject: [PATCH 2/2] Set the display_exceptions variable on the 404 view if we want to display exceptions. --- library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php b/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php index aed36dc6401..81eb7d80e62 100644 --- a/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php +++ b/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php @@ -276,6 +276,8 @@ protected function injectException($model, $e) return; } + $model->setVariable('display_exceptions', true); + $exception = $e->getParam('exception', false); if (!$exception instanceof \Exception) { return;