Skip to content

Conversation

@yoeunes
Copy link
Contributor

@yoeunes yoeunes commented Nov 22, 2025

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

The Autowire attribute uses a chain of xor conditions to ensure that only one of $value, $service, $expression, $env, or $param is passed.

However, xor is pairwise associative. If three of these arguments are passed, the expression evaluates to true ((true ^ true) ^ true === true), and the validation passes incorrectly.

@carsonbot carsonbot added this to the 6.4 milestone Nov 22, 2025
@yoeunes yoeunes force-pushed the di-autowire-attribute-xor-check branch 2 times, most recently from 7ed0e29 to 765cd5f Compare November 22, 2025 16:21
@yoeunes yoeunes force-pushed the di-autowire-attribute-xor-check branch from 765cd5f to c9fda09 Compare November 22, 2025 21:34
@OskarStark OskarStark changed the title [DependencyInjection] Fix loose validation in #[Autowire] attribute [DependencyInjection] Fix loose validation in #[Autowire] attribute Nov 22, 2025
@yoeunes yoeunes force-pushed the di-autowire-attribute-xor-check branch from c9fda09 to f0a2f56 Compare November 24, 2025 22:51
@fabpot
Copy link
Member

fabpot commented Nov 29, 2025

Thank you @yoeunes.

@fabpot fabpot merged commit d0015c2 into symfony:6.4 Nov 29, 2025
11 checks passed
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.

7 participants