Closed
Description
Since #19681 was merged there is a kind of regression in routing configuration. In the routing config files, parameters on the form %env(FOO)%
are interpreted like regular old parameters, rather than environment parameters (i.e. they always use the value set in e.g. parameters.yml). This is confusing for users.
Ideally we'd want to fix this so that env var parameters work here too, but seeing as how late we are in the release schedule, I suggest we simply disallow using parameters on the form %env(FOO)%
by throwing an exception in Symfony\Bundle\FrameworkBundle\Routing\Router::resolve
when one is encountered, and we can fix the issue fully in a later patch release. Sounds good?
Reproduction
# routing.yml
foo:
path: /bar
schemes: ["%env(PROTOCOL)%"]
# parameters.yml
parameters:
env(PROTOCOL): https
Expected behavior
magnus@Turing ~/D/T/envtest> env PROTOCOL=http bin/console debug:router
------ -------- -------- ------ ------
Name Method Scheme Host Path
------ -------- -------- ------ ------
foo ANY http ANY /bar
------ -------- -------- ------ ------
Actual behavior
magnus@Turing ~/D/T/envtest> env PROTOCOL=http bin/console debug:router
------ -------- -------- ------ ------
Name Method Scheme Host Path
------ -------- -------- ------ ------
foo ANY https ANY /bar
------ -------- -------- ------ ------