Skip to content

Fix is_callable() third $callable_name by-ref argument (#9505) - #9509

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-9505-is-callable-name-byref
Jun 18, 2026
Merged

Fix is_callable() third $callable_name by-ref argument (#9505)#9509
PurHur merged 1 commit into
masterfrom
agent/issue-9505-is-callable-name-byref

Conversation

@PurHur

@PurHur PurHur commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Register is_callable argument Stdlib: ceil, floor, intval and expanded PHPT specs #3 ($callable_name) in BuiltinByRefParams / BuiltinParamNames so the VM validates and binds by-ref correctly.
  • Fix VmCallable::writeCallableName() — use resolveIndirect()->string() (the old Variable::isReference() call was undefined and fatal).
  • Align php-src name population: write $callable_name even when the check returns false (e.g. unknown function still reports 'NoSuchFunction_xyz').
  • Extend JitIsCallable to write the resolved name into the third argument under AOT/JIT.

php-src reference: ext/standard/basic_functions.cPHP_FUNCTION(is_callable)

Verification

# VM repro (matches Zend PHP 8.2)
php bin/vm.php test/repro/maintainer_gap_is_callable_name_byref.php
# true 'strlen'
# false 'NoSuchFunction_xyz'

php test/repro/maintainer_gap_is_callable_name_byref.php
# same output

# Unit
./vendor/bin/phpunit test/unit/BuiltinByRefParamsTest.php --no-configuration
# OK (6 tests)

# AOT (Docker harness)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/compile.php /tmp/is_callable_aot.php -o /tmp/is_callable_aot && /tmp/is_callable_aot'
# true strlen

Closes #9505

Made with Cursor

Register the optional name out-param in BuiltinByRefParams, write through
resolveIndirect() in VmCallable (replacing the broken isReference() call),
align php-src name population on failure paths, and teach JitIsCallable to
write the resolved name under AOT.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 3de7d52 into master Jun 18, 2026
@PurHur
PurHur deleted the agent/issue-9505-is-callable-name-byref branch June 18, 2026 05:41
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.

Stdlib: is_callable() third $name by-ref argument fatal — must populate callable name (ext/standard/basic_functions.c)

1 participant