Commit 20103a8
committed
bug #62485 [DependencyInjection] Fix loop corruption in
This PR was merged into the 6.4 branch.
Discussion
----------
[DependencyInjection] Fix loop corruption in `CheckTypeDeclarationsPass`
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | -
| License | MIT
In `CheckTypeDeclarationsPass`, the loop counter `$i` was incorrectly overwritten with the parameter name when processing **named arguments**.
Comparing a string to an integer [here](https://github.com/yoeunes/symfony/blob/3866ff11d86331d1acf49043f5c86b2a054db60f/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php#L140) (e.g. `'b' < 2`) evaluates to `false`. This caused the loop to terminate early, skipping type validation for all subsequent arguments.
Commits
-------
3866ff1 [DependencyInjection] Fix loop corruption in CheckTypeDeclarationsPassCheckTypeDeclarationsPass (yoeunes)File tree
2 files changed
+22
-2
lines changed- src/Symfony/Component/DependencyInjection
- Compiler
- Tests/Compiler
2 files changed
+22
-2
lines changedLines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
145 | 146 | | |
146 | | - | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
151 | | - | |
| 152 | + | |
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1023 | 1023 | | |
1024 | 1024 | | |
1025 | 1025 | | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
1026 | 1038 | | |
1027 | 1039 | | |
1028 | 1040 | | |
| |||
1038 | 1050 | | |
1039 | 1051 | | |
1040 | 1052 | | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
0 commit comments