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
[4.1 BC Break][DI] Env placeholder defaulting to float now rejected for scalar config node #27455
Comments
Gave it a quick look, and i think we can include all scalar types here: symfony/src/Symfony/Component/DependencyInjection/Compiler/ValidateEnvPlaceholdersPass.php Line 50 in c81f88f
As those types are in fact allowed as env parameter defaults (or only number|string i believe) |
On the other side.. we can also deprecate non-string values here 🤔 as we imply a default string prefix (for envs being string values) symfony/src/Symfony/Component/DependencyInjection/Compiler/ValidateEnvPlaceholdersPass.php Line 49 in c81f88f
|
We should not force ppl to be stricter than PHP's default mode. Let's follow the default coercion rules. |
This PR was squashed before being merged into the 4.1 branch (closes #27470). Discussion ---------- [DI] Remove default env type check on validate | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #27455 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> The default env is already validated to be a scalar or null on `get()` Commits ------- a0015a1 [DI] Remove default env type check on validate
Symfony version(s) affected: 4.1.0
Description
Symfony 4.1.0 introduced validation of env vars in #23888. This breaks env defaults defined as parameters directly in YAML config for seemingly incompatible types, i.e. env defaulting to float value while node is declared as
scalarNode
(float is scalar too btw).How to reproduce
This is based on real configuration of SncRedisBundle which now suffers from this BC break.
Have a bundle with DI configuration having a scalar config node as such:
Then configured using YAML like this:
Since
options.profile
is defined asscalarNode()
, default value3.2
(being a float) is rejected and exception above is thrown.Additional context
The text was updated successfully, but these errors were encountered: