Symfony2 is_granted('IS_AUTHENTICATED_FULLY') during 404 error page display, causing ResourceNotFoundException-Collection of common programming errors
I have setup custom error pages to display for certain HTTP errors in the folder:
app/Resources/TwigBundle/views/Exception/
The 403 page (error403.html.twig
) works and displays as expected.
The 500 page (error500.html.twig
) works and displays as expected.
The 404 page (error404.html.twig
) throws a 500 server error:
PHP Fatal error: Uncaught exception ‘Symfony\Component\Routing\Exception\ResourceNotFoundException’
The error is being thrown by doing an auth check to display certain menu items for users that are or aren’t authenticated:
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
If I remove that check and just allow all menu items to display, the page loads the error page as expected. Again, the 403 page displays as it should and utilizes the auth checks without a problem.
I’m stuck on this one. The pages are EXACTLY the same, apart from the filename.
Originally posted 2013-11-27 12:01:05.