Skip to content

Commit cd0e142

Browse files
committed
Merge pull request #2079 from WouterJ/issue_2078
[2.1] Added caution about using is_granted in error pages
2 parents aa4b115 + 0d82503 commit cd0e142

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cookbook/controller/error_pages.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ end-user, create a new template located at
5050
</body>
5151
</html>
5252

53+
.. caution::
54+
55+
You **must not** use ``is_granted`` in your error pages, because the
56+
router runs before the firewall. If the router throws an exception (for
57+
instance, when the route does not match), the error page is not behind a
58+
firewall and ``app.user`` is not defined.
59+
5360
.. tip::
5461

5562
If you're not familiar with Twig, don't worry. Twig is a simple, powerful

0 commit comments

Comments
 (0)