Skip to content

Stdlib: readonly() function_exists false on PHP_COMPILER_PROFILE=8.4 — introspection gate (ext/standard/basic_functions.c) #17693

Description

@PurHur

Category

stdlib · php-src-strict · PHP 8.4 forward profile

Problem

readonly(object) semantics work on the 8.4 forward profile (dynamic objects become immutable; re-apply throws), but function_exists('readonly') is false and call sites observe a NULL return instead of void. Zend exposes the builtin on PHP 8.4+ with truthful introspection.

Repro Zend 8.4 VM 8.4 profile (2026-07-10)
function_exists('readonly') true false
var_export(readonly($o)) after mark NULL (void) NULL (ok) but introspection false
$o->x = 2 after readonly($o) Error: Cannot modify readonly object same ✅

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro-maintainer/issue_readonly_function.php'

Done when

  • function_exists('readonly') is true on PHP_COMPILER_PROFILE=8.4
  • readonly($o) returns void (no spurious NULL in var_export contexts)
  • VM + JIT + compliance guard for dynamic-object readonly mark
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 10, 2026
  2. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Runtime → PHP — starting this run.

  3. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Merged via #17700.

    Fix: advertisesReadonlyBuiltin() now mirrors advertisesZendThreadId() — forward PHP_COMPILER_PROFILE=8.4 advertises readonly to function_exists() while reference 8.4.0-dev keeps the phantom gate.

    Verification:

    • PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro-maintainer/issue_readonly_function.php → true + readonly semantics
    • ForwardProfilePhantomIntrospectionTest::testReadonlyAdvertisedOnForwardProfile84 green
    • ./script/ci-fast.sh exit 0
  4. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #17676, #17693, #17680)

  5. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Merged via #17703.

    Verification (VM):

    php bin/vm.php test/repro/maintainer_gap_define_object_constant.php  # #17676 → ok
    php bin/vm.php test/repro/maintainer_gap_ldap_extension_loaded_phantom.php  # #17680 → ok
    PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro-maintainer/issue_readonly_function.php  # #17693 → true + readonly semantics
    ./script/phpunit.sh --filter define_object_constant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions