-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
[DependencyInjection][Config] Use several placeholder unique prefixes for dynamic placeholder values #37511
Conversation
There was a problem hiding this 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.
src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
Show resolved
Hide resolved
b1837b1
to
d8ca8be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
...Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php
Show resolved
Hide resolved
d8ca8be
to
2948631
Compare
There's a failure on deps=low to investigate. |
… for dynamic placeholder values
2948631
to
3d754ad
Compare
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. |
Thank you @fancyweb. |
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