Commit d0015c2
committed
bug #62482 [DependencyInjection] Fix loose validation in
This PR was merged into the 6.4 branch.
Discussion
----------
[DependencyInjection] Fix loose validation in `#[Autowire]` attribute
| 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.
Commits
-------
f0a2f56 [DependencyInjection] Fix loose validation in #[Autowire] attribute#[Autowire] attribute (yoeunes)File tree
2 files changed
+21
-1
lines changed- src/Symfony/Component/DependencyInjection
- Attribute
- Tests/Attribute
2 files changed
+21
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
85 | 105 | | |
0 commit comments