Skip to content

Stdlib: advertise readonly() on PHP_COMPILER_PROFILE=8.4 (#17693) - #17700

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-readonly-function-exists
Jul 10, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-readonly-function-exists

Conversation

@PurHur

@PurHur PurHur commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Align CompilerVersion::advertisesReadonlyBuiltin() with the forward-profile pattern used by advertisesZendThreadId(): on PHP_COMPILER_PROFILE=8.4, function_exists('readonly') is now true.
  • Reference 8.4.0-dev profile (no forward profile) still withholds readonly from introspection to match Zend 8.2 phantom gate.

Root cause

advertisesReadonlyBuiltin() only checked stable CompilerVersion::VERSION >= 8.4.0, so forward-profile callers could invoke readonly($o) but function_exists('readonly') returned false.

php-src reference

  • ext/standard/basic_functions.c — PHP_FUNCTION(readonly) registration on PHP 8.4+

PHP implementation

  • lib/CompilerVersion.php — introspection gate
  • ext/standard/BuiltinIntrospectionPolicy.php — unchanged (already routes through gate)

C runtime shrink

No new C; introspection-only PHP gate fix.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro-maintainer/issue_readonly_function.php'
# true
# Cannot modify readonly object of class stdClass
# reapply: Object is already readonly

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
PHP_COMPILER_PROFILE=8.4 vendor/bin/phpunit --filter testReadonlyAdvertisedOnForwardProfile84 test/unit/ForwardProfilePhantomIntrospectionTest.php'
# OK (1 test, 5 assertions)

./script/ci-fast.sh
# exit 0

Closes #17693

Made with Cursor

Forward 8.4 profile now matches Zend introspection: function_exists('readonly')
returns true while reference 8.4.0-dev profile keeps the phantom gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit ca7b8bd into master Jul 10, 2026
@PurHur
PurHur deleted the agent/runtime-php-readonly-function-exists branch July 10, 2026 19:19
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: readonly() function_exists false on PHP_COMPILER_PROFILE=8.4 — introspection gate (ext/standard/basic_functions.c)

1 participant