Commit 0e8ae8f
committed
bug #62646 [DependencyInjection] Throw when using
This PR was merged into the 7.4 branch.
Discussion
----------
[DependencyInjection] Throw when using `$this` or its internal scope from PHP config files
| Q | A
| ------------- | ---
| Branch? | 7.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | #62547
| License | MIT
The BC layer brought by #61860 doesn't work: as described in #62547, the first call to load() has side effects which can break when the second and fallback call is made.
I don't see any other way. Well, one would be to operate on a clone, and if that works, rerun with the real container builder. But the overhead is going to be high for everybody.
I'm therefor proposing to change this as a BC BREAK. While less than ideal, this happens at compile time, and the fix is trivial and explained in the error message.
Commits
-------
7ffcd64 [DependencyInjection] Throw when using `$this` or its internal scope from PHP config files; use the `$loader` variable instead$this or its internal scope from PHP config files (nicolas-grekas)File tree
4 files changed
+5
-13
lines changed- src/Symfony/Component/DependencyInjection
- Loader
- Tests/Loader
4 files changed
+5
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | | - | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 1 addition & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
336 | 334 | | |
337 | 335 | | |
338 | 336 | | |
339 | 337 | | |
340 | 338 | | |
341 | | - | |
| 339 | + | |
| 340 | + | |
342 | 341 | | |
343 | 342 | | |
344 | 343 | | |
| |||
0 commit comments