Closed
Description
Symfony version(s) affected: 4.2.4
Description
In security.yaml, trying to set the security of a firewall from an env does not work.
How to reproduce
- Have a .env file as below:
SECURITY_ENABLED=0
- Now go to
config/packages/security.yaml
, have it as below:
parameters:
security_enabled: '%env(bool:SECURITY_ENABLED)%'
security:
...
firewalls:
secured_area:
security: '%security_enabled%'
pattern: ^/
- Now run the command
bin/console debug:config SecurityBundle
and you get the bug
In BooleanNode.php line 29:
Invalid type for path "security.firewalls.secured_area.security". Expected boolean, but got string.
I have tried the following .env values
SECURITY_ENABLED=
# OR
SECURITY_ENABLED=0
# OR
SECURITY_ENABLED=false
# OR
SECURITY_ENABLED='false'
None of the above work. The cache clears though, and when accessing a route, the system behaves as if security is turned on. Substituting security: '%security_enabled%'
with security: false
works correctly and security is disabled.