-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Document **not** to use is_granted in templates: "How to Customize Error Pages" #2078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Well, in some cases, you can, but not always. A safe way to use it is |
@stof I understand this (old) issue is down to the order of the listeners, but you say "in some cases you can" - in what cases would |
@adamquaile when there is an error page that happend before initializing Security (in the referenced PR, there was an issue with the router, which is executed before the firewall, so it couldn't be used). |
@wouterj Yeah, I get that. I'm wondering in what cases the firewall is executed before the routing exception..?
I get why you can't, but why would it ever work? Would this only apply if we manually threw the not found exception from a controller? |
By the way, with Symfony 2.8 you will be able to always use |
@adamquaile not all exceptions happen in the routing. The "in some cases" is about the other errors not happening in routing |
@wouterj Okay. Got it, thanks. |
For Symfony 2.1, your error template can not use
is_granted
in your Twig template. For details, see symfony/symfony#5320. We should document this clearly, especially since this is difficult to debug and you probably won't see it until you're on production.The text was updated successfully, but these errors were encountered: