Commit 94e9657
Fix initializedEmpty not propagating through createFromConstantArray round-trips
When processing `$a = []; $a[-10] = 'a'; $a[-5] = 'b';`, the second
assignment creates a new builder via createFromConstantArray with a
non-empty array, losing the initializedEmpty flag. This caused
shouldUpdateAutoIndex to incorrectly return true on PHP 8.0-8.2.
Fix: in createFromConstantArray, also infer initializedEmpty when the
source array has negative int keys but max(nextAutoIndexes) === 0,
since a non-empty initializer on PHP 8.0+ would have already bumped
the auto-index.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2ad0306 commit 94e9657
1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
| |||
0 commit comments