From 0d8250355a89e98f280cefa8cc39b3766e088845 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 31 Dec 2012 10:32:12 +0100 Subject: [PATCH] Added caution about using is_granted in error pages --- cookbook/controller/error_pages.rst | 7 +++++++ 1 file changed, 7 insertions(+) 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