Skip to content

Fix AOT array_first/array_last wrong output under PROFILE=8.5 (#27596) - #28105

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-27596-array-first-last-aot
Aug 6, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-27596-array-first-last-aot

Conversation

@PurHur

@PurHur PurHur commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Problem

NestedJIT ArrayElemJitHelper Variable returns were wrong (NULL / Object) or segfaulted under phpc build while VM/JIT matched Zend (#27596).

Verification

export PHP_COMPILER_PROFILE=8.5
# Issue repro (echo — json_encode still aborts separately under thin AOT #23540)
cat > /tmp/issue27596.php <<'PHP'
<?php
echo array_first([10, 20]), ",", array_last([10, 20]), ",", var_export(array_first([]), true), "\n";
PHP
php bin/vm.php /tmp/issue27596.php          # 10,20,NULL
php bin/compile.php -o /tmp/issue27596 /tmp/issue27596.php && /tmp/issue27596  # 10,20,NULL exit=0

php vendor/bin/phpunit --filter array_first_last test/aot/AotTest.php  # OK (4 tests)
php vendor/bin/phpunit test/unit/ArrayElemRuntimeShrinkTest.php       # OK (5 tests)

Not covered

Closes #27596

Made with Cursor

NestedJIT ArrayElemJitHelper returns wrong values under thin standalone AOT;
route user-script builds through pure LLVM (peer HashTableShiftLlvm #24025) while
JIT/MCJIT keep the php-in-PHP helper bridge.

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: AOT array_first()/array_last() wrong/segfault — VM/JIT match Zend (PROFILE=8.5, ext/standard/array.c)

1 participant