Skip to content

[DependencyInjection] Improve url env var processor with type cast #15611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2021

Conversation

noniagriconomie
Copy link
Contributor

@noniagriconomie noniagriconomie commented Aug 11, 2021

Hi

I've tried on my symfony app v4.4, the env(url:FOO) env processor reading the doc at https://symfony.com/doc/4.4/configuration/env_var_processors.html


Without the changes proposed in this PR, I got:

  • with definition like this in an app.yaml file
    • service.port: '%env(key:port:url:SERVICE_DSN)%'
  • the error
    • Invalid type for path "service.port". Expected one of "bool", "int", "float", "string", but got one of "bool", "int", "float", "string", "array".

but it works only like this:

  • service.port: '%env(int:key:port:url:SERVICE_DSN)%'
  • same with string: for example a key:user or a key:pass fields from the url processor

Thus I am proposing this PR to correct the usage of this processor
If I am doing something wrong/incorrect, please answer what/why and feel free to close this PR!

Thank you :)


Symfony 4.4.29
PHP 7.4.22

@carsonbot carsonbot added this to the 4.4 milestone Aug 11, 2021
@carsonbot carsonbot changed the title Improve url env var processor with type cast [DependencyInjection] Improve url env var processor with type cast Aug 12, 2021
@javiereguiluz
Copy link
Member

Nice fix and perfectly explained ❤️ Thanks Antoine!

@javiereguiluz javiereguiluz merged commit 38834b7 into symfony:4.4 Aug 12, 2021
@noniagriconomie noniagriconomie deleted the fx-env-var-url branch August 12, 2021 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants