Skip to content

Fix nested scalar-return builtin in call argument evaluates to null (#10495) - #10582

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-10495-nested-string-builtin-arg
Jun 22, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-10495-nested-string-builtin-arg

Conversation

@PurHur

@PurHur PurHur commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #10495

php-src / PHP-in-PHP

Reference PHP implementation
Zend/zend_execute.c nested call arg evaluation lib/Compiler.php — inline call-arg producer matching

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "
echo var_export(get_debug_type(null), true), \"\\n\";
echo var_export(gettype(null), true), \"\\n\";
echo var_export(json_encode(null), true), \"\\n\";
echo var_export(get_class(new stdClass()), true), \"\\n\";
"
./vendor/bin/phpunit --filter testVarExportNestedScalarBuiltinUsesFuncCallProducerSlot test/unit/InlineCallArgProducerSlotTest.php
./vendor/bin/phpunit --filter nested_string_builtin_arg test/compliance/
'

Results (2026-06-22):

  • VM inline repro prints 'null', 'NULL', 'null', 'stdClass' (was NULL for nested calls)
  • InlineCallArgProducerSlotTest::testVarExportNestedScalarBuiltinUsesFuncCallProducerSlot — OK
  • nested_string_builtin_arg.phpt compliance — OK (VM + JIT matrix)

Made with Cursor

When php-cfg hoists trailing literal ConstFetch nodes between nested FuncCalls
(e.g. var_export(get_debug_type(null), true)), wire the inner FUNCCALL_EXEC_RETURN
slot to the outer TYPE_ARG_SEND instead of a dead temp.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit fd72dbe into master Jun 22, 2026
@PurHur
PurHur deleted the agent/issue-10495-nested-string-builtin-arg branch June 22, 2026 18:34
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: nested string/scalar-return builtin in call argument evaluates to null (extends #9547, Zend/zend_execute.c)

1 participant