Skip to content

[DependencyInjection][Config] Use several placeholder unique prefixes for dynamic placeholder values #37511

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

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Jul 7, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets #37426
License MIT
Doc PR -

Currently, in Config BaseNode, we are only able to check on one dynamic placeholder unique prefix (ie one env placeholder unique prefix in our usage) to ignore the validation of config values that contain placeholder values. It isn't enough in some scenarios, we would need to be able to check on multiple prefixes.

In MergeExtensionConfigurationPass we need to not validate config values that are placeholders (they are checked later by a dedicated pass), so we set the BaseNode placeholder unique prefix for each processed extension. Because the env placeholder unique prefix depends of the bag data, if a first extension creates the env placeholder and adds a parameter to the bag, the second extension reusing the same env placeholder will generate a different env placeholder unique prefix. Therefore the validation of the value will not be skipped because the env placeholder contains the first env placeholder unique prefix while the BaseNode placeholder unique prefix is set with the second.

Another solution might be to mutate the existing env placeholders to use the new unique prefix when merging the env placeholders ? I guess it depends on which side we want to fix this (DI or Config).

cc @ro0NL

Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think for config component being able to specify multiple prefixes is a nice feature addition.

i tend to believe the root issue is ideally solved in the DI component, by keeping a single prefix. But i havent looked in depth at it to fully understand the root cause here.

@nicolas-grekas nicolas-grekas added this to the 4.4 milestone Jul 7, 2020
@fancyweb fancyweb force-pushed the di-env-placeholder-multiple-extensions branch from b1837b1 to d8ca8be Compare July 8, 2020 07:50
Copy link
Contributor

@ro0NL ro0NL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@fancyweb fancyweb force-pushed the di-env-placeholder-multiple-extensions branch from d8ca8be to 2948631 Compare July 10, 2020 13:18
@nicolas-grekas
Copy link
Member

There's a failure on deps=low to investigate.

@fancyweb fancyweb force-pushed the di-env-placeholder-multiple-extensions branch from 2948631 to 3d754ad Compare July 15, 2020 08:28
@fancyweb
Copy link
Contributor Author

fancyweb commented Jul 15, 2020

The test cannot work with previous Config versions. We are not going to to bump the whole dependency for this. So the test is skipped conditionally. Remaining failures are unrelated.

@nicolas-grekas
Copy link
Member

Thank you @fancyweb.

@nicolas-grekas nicolas-grekas merged commit a3bd36c into symfony:4.4 Jul 15, 2020
@fancyweb fancyweb deleted the di-env-placeholder-multiple-extensions branch July 15, 2020 09:03
This was referenced Jul 24, 2020
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.

4 participants