Closed
Description
Symfony version(s) affected
5.4.11
Description
Currently, if you don't have any security config, the Security bundle skips loading any of its conifg:
This can lead to weird errors like:
Did you forget to run "composer require symfony/twig-bundle"? Unknown function "is_granted" in "template.html.twig".
The developer is left to debug why Twig bundle is not being loaded, why the Security bundle is not loaded (they both are) (I'd argue that this itself is a bug).
How to reproduce
- Create a new symfony project
- don't define any security
- try to use some security related feature (like the mentioned Twig function) and see the error message
Possible Solution
- warn about security not having any config (AFAIK it needs at least one firewall)
- load some (most) services into the container even without the config
Additional Context
This happens if you're setting up a tiny Symfony app for functional tests where you need the smallest working config, you might omit things you're not directly interested in, but that can have unintended consequences which are hard to debug.