Closed
Description
Symfony version(s) affected: 5.2.2
Description
when using the role_names
attribute in an expression of your access control configuration, warming the cache will fail with an Variable "role_names" is not valid around position...
message because the cache warmer expects a roles
attribute.
the documentation on this feature also is confusing as the given example uses role_names
while the description uses the roles
attribute: https://symfony.com/doc/current/security/expressions.html
How to reproduce
add the following in your acces_control config of the security config and run a bin/console cache:clear
:
access_control:
- { path: '^/', allow_if: "'ROLE_ADMIN' in role_names"}
Possible Solution
change the roles
attribute to role_names
in the ExpressionCacheWarmer
and correct the documentation accordingly.