Skip to content

Fix array spread traversable compliance + JIT test (#4686) - #7565

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-4686-array-spread-traversable-jit
Jun 7, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-4686-array-spread-traversable-jit

Conversation

@PurHur

@PurHur PurHur commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix array_spread_traversable.phpt: remove ...null block that expected catchable TypeError; Zend/php-src and ArraySpread use uncatchable fatal (#4812).
  • Add array_spread_null_fatal.phpt for null spread fatal semantics.
  • Add array_spread_traversable_jit.phpt guarding JIT execute parity for IteratorAggregate, Generator, and Iterator spread (lowering already in HashTableHelper::spreadInto + JitIteratorToArray).

Closes #4686

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
sed -n "/^--FILE--$/,/^--EXPECT--$/p" test/compliance/cases/language/array_spread_traversable.phpt | tail -n +2 | head -n -1 > /tmp/spread_trav.php
php /tmp/spread_trav.php
php bin/vm.php /tmp/spread_trav.php
php bin/jit.php /tmp/spread_trav.php
./vendor/bin/phpunit --filter array_spread
'

Output (VM/JIT match Zend for traversable operands):

array (
  'a' => 1,
  'b' => 2,
)
array (
  0 => 10,
  1 => 20,
)
array (
  0 => 1,
  1 => 2,
  2 => 3,
)

PHPUnit:

OK (16 tests, 20 assertions)

Made with Cursor

Traversable spread already matches Zend on VM and JIT via HashTableHelper::spreadInto; the traversable PHPT wrongly expected catchable TypeError on ...null (Zend E_ERROR per #4812). Split null fatal into its own case and add JIT execute coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 3339a37 into master Jun 7, 2026
@PurHur
PurHur deleted the agent/issue-4686-array-spread-traversable-jit branch June 7, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: array literal spread — Traversable/Generator operands on JIT/AOT (phase 2 of #4453)

1 participant