Repository navigation
Commit c3fb17b
committed
Keep the tracked offsets of a widened variable that both loop passes track
Widening a variable between loop passes dropped every tracked expression on
it, such as $byHash[$hash] after $byHash[$hash]['list'][] = $x widened
$byHash. The next pass then no longer knew the offset exists, so the write
could start a new array{list: ...} and the shape lost its other keys:
array{block: Block, list: list<X>} -> array<'block'|'list', Block|list<X>>
with false "Cannot access an offset on Block|list<X>" after it. Nested loops
converging in the enclosing loop's passes hit this in shopware, matomo,
glpi, openemr, pmmp, phpstan-dba and phpstan-laravel.
An expression both passes track is now widened like any other; only one
that the other pass does not track is dropped, as before.
- bug-10438: $meta[$key] after $meta[$key] = [] is list<string> inside the
inner loop, no longer list<string>|string.
- turbo-ext: the same in MutatingScope.cpp.
Amp-Thread-ID: https://ampcode.com/threads/T-01a17eac-1199-74a6-b3f7-dfbd8a0844651 parent 7c7ff95 commit c3fb17b
4 files changed
Lines changed: 108 additions & 30 deletions
File tree
- src/Analyser
- tests/PHPStan/Analyser/nsrt
- turbo-ext/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5008 | 5008 | | |
5009 | 5009 | | |
5010 | 5010 | | |
5011 | | - | |
5012 | | - | |
5013 | | - | |
| 5011 | + | |
| 5012 | + | |
| 5013 | + | |
| 5014 | + | |
| 5015 | + | |
| 5016 | + | |
| 5017 | + | |
| 5018 | + | |
| 5019 | + | |
5014 | 5020 | | |
5015 | 5021 | | |
5016 | | - | |
5017 | | - | |
5018 | | - | |
5019 | 5022 | | |
5020 | 5023 | | |
5021 | 5024 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9376 | 9376 | | |
9377 | 9377 | | |
9378 | 9378 | | |
9379 | | - | |
9380 | | - | |
9381 | | - | |
9382 | | - | |
9383 | | - | |
9384 | | - | |
9385 | | - | |
9386 | | - | |
9387 | | - | |
9388 | | - | |
9389 | | - | |
9390 | | - | |
9391 | | - | |
9392 | | - | |
9393 | | - | |
9394 | | - | |
9395 | | - | |
9396 | | - | |
9397 | | - | |
9398 | | - | |
9399 | | - | |
9400 | | - | |
9401 | | - | |
9402 | 9379 | | |
9403 | 9380 | | |
| 9381 | + | |
| 9382 | + | |
| 9383 | + | |
| 9384 | + | |
| 9385 | + | |
| 9386 | + | |
| 9387 | + | |
| 9388 | + | |
| 9389 | + | |
| 9390 | + | |
| 9391 | + | |
| 9392 | + | |
| 9393 | + | |
| 9394 | + | |
| 9395 | + | |
| 9396 | + | |
| 9397 | + | |
| 9398 | + | |
| 9399 | + | |
| 9400 | + | |
| 9401 | + | |
| 9402 | + | |
| 9403 | + | |
| 9404 | + | |
| 9405 | + | |
9404 | 9406 | | |
9405 | 9407 | | |
9406 | 9408 | | |
| |||
0 commit comments