Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd0e142

Browse filesBrowse 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
Copy full SHA for cd0e142

File tree

Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed

‎cookbook/controller/error_pages.rst

Copy file name to clipboardExpand all lines: cookbook/controller/error_pages.rst
+7Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.