Skip to content
This repository has been archived by the owner on Jan 1, 2020. It is now read-only.

The display_exceptions config-option is not passed to views #155

Closed
androa opened this issue Jan 17, 2013 · 1 comment
Closed

The display_exceptions config-option is not passed to views #155

androa opened this issue Jan 17, 2013 · 1 comment

Comments

@androa
Copy link

androa commented Jan 17, 2013

The skeleton app uses an if ($this->display_exceptions) in order to check if exceptions should be displayed: https://github.com/zendframework/ZendSkeletonApplication/blob/master/module/Application/view/error/404.phtml#L49

But this view variable is never set, it's just used in the RouteNotFoundStrategy to inject the exception: https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php#L275

I guess display_exceptions either need to be set in the view or the check should be removed and just do an isset($this->exception). I'm unable to find the exact point in time where this changed and stopped working.

@androa
Copy link
Author

androa commented Jan 18, 2013

So, got to debug it a bit more. The issue is this: https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/View/Http/ExceptionStrategy.php#L152

When there is a fallback exception the display_exceptions view variable is set along with the exception. If it's a 404/not found exception the exception is passed in, but display_exceptions is not.

Two different ways to fix it:
A.) Update the 404 view file to simply check if it's a exception there. https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php#L275 checks if exceptions should be displayed anyways.
B.) Inject the display_exceptions variable before https://github.com/zendframework/zf2/blob/master/library/Zend/Mvc/View/Http/RouteNotFoundStrategy.php#L284 (or somewhere else).

The last one is probably the best in order to preserve consistency across the different errors.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants