diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index d776a1575b4..99f71dd527a 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -50,6 +50,13 @@ end-user, create a new template located at +.. caution:: + + You **must not** use ``is_granted`` in your error pages, because the + router runs before the firewall. If the router throws an exception (for + instance, when the route does not match), the error page is not behind a + firewall and ``app.user`` is not defined. + .. tip:: If you're not familiar with Twig, don't worry. Twig is a simple, powerful