Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Router does not handle env var parameters. #20682

Copy link
Copy link
Closed
@magnusnordlander

Description

@magnusnordlander
Issue body actions

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  
 ------ -------- -------- ------ ------ 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.