Skip to content

[DependencyInjection] Fix env default processor with scalar node #59262

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
Feb 7, 2025

Conversation

tBibaut
Copy link
Contributor

@tBibaut tBibaut commented Dec 19, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

When a default processor was used, the provided type was bool|int|float|string|array
It was too wide when validated by a scalarNode.

For example, switching a config from :

scalar_node: "%env(FOO_ENV)%"

to :

scalar_node: "%env(default:foo_param:FOO_ENV)%"

Would throw this exception :

[Symfony\Component\Config\Definition\Exception\InvalidTypeException]         
 Invalid type for path "scalar_node". Expected one of "bool", "int", "float", "string", but got one of "bool", "int", "float", "string", "array".    

This fix narrows the provided type to the combination of the parameter and the environment variable types.

@tBibaut tBibaut force-pushed the fix/default-env-processor branch from 72564bc to 27d2c96 Compare December 19, 2024 14:09
@fabpot
Copy link
Member

fabpot commented Feb 7, 2025

Thank you @tBibaut.

@fabpot fabpot merged commit 06b9c31 into symfony:6.4 Feb 7, 2025
11 checks passed
This was referenced Feb 26, 2025
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.

5 participants