Skip to content

Fix array_intersect_assoc() inline array_keys() sibling producer wiring (#13778) - #13784

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-13778-array-intersect-assoc-inline-array-keys
Jun 29, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-13778-array-intersect-assoc-inline-array-keys

Conversation

@PurHur

@PurHur PurHur commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes compile-time inline call-arg producer wiring for array_intersect_assoc(array_keys(...), array_keys(...)) — sibling hoisted array_keys() calls with interleaved Array_ preludes now map to consumer args by FuncCall ordinal, and each nested array_keys() receives the Array_ stmt immediately before it (not the block’s most recent INIT_ARRAY).
  • PHP implementation in lib/Compiler.php only (no C/runtime changes).

Closes #13778

php-src reference

  • ext/standard/array.c — php_array_intersect_assoc()

PHP implementation

  • lib/Compiler.php — sibling inline FuncCall ordinal wiring + immediate Array_ arg binding

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
./vendor/bin/phpunit --filter testArrayIntersectAssocInlineArrayKeysRuntime test/unit/InlineCallArgProducerSlotTest.php
php test/repro/maintainer_gap_array_intersect_assoc_inline_array_keys.php
php bin/vm.php test/repro/maintainer_gap_array_intersect_assoc_inline_array_keys.php
./vendor/bin/phpunit --filter "testVarDumpReceivesDistinctClosureCallProducerSlots|testClosureStaticVarDumpMultiArgRuntime|testArrayMergeLeadingArrayTrailingArrayKeysRuntime|testArrayMergeInlineArrayKeysRuntime" test/unit/InlineCallArgProducerSlotTest.php
'
OK (1 test, 7 assertions)
array (
  0 => 'a',
)
ok
array (
  0 => 'a',
)
ok
OK (4 tests, 19 assertions)

Made with Cursor

…ng (#13778).

When php-cfg hoists Array_ literals between sibling FuncCall producers, map
operands by FuncCall ordinal (not raw cfg distance) and wire each nested
array_keys() to the Array_ stmt immediately before it — not the most recent
INIT_ARRAY on the block.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Regression: array_intersect_assoc() inline array_keys() — LogicException not intersection (ext/standard/array.c)

1 participant