Skip to content

Regression: forward-profile builtins register on 8.2 reference — mb_trim/crc32c/hebrevc leak (ext/standard/Module.php) #17206

Closed

Description

@PurHur

Category

Regression · php-src-strict · profile gating / function_exists parity

Problem

On the default 8.2 reference profile (no PHP_COMPILER_PROFILE), several PHP 8.3/8.4-only builtins are registered and callable in this compiler while Zend 8.2 reports function_exists(...) === false. This breaks profile parity and lets user code detect the non-Zend runtime.

Builtin Zend 8.2 function_exists VM 8.2 (2026-07-07)
mb_trim false true (callable)
crc32c false true
hebrevc false true
attribute_exists false true
class_uses_recursive false true

php-src reference

PHP implementation target

  • ext/standard/Module.php, ext/mbstring/Module.php — gate registration on CompilerVersion profile helpers (same pattern as supportsListDestructuringSpreadAssign())
  • lib/CompilerVersion.php — centralize per-builtin profile predicates; avoid orphan function_exists entries
  • JIT/AOT builtin tables must respect the same gates

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_forward_profile_builtin_leak_82.php'
# VM: fail lists leaked symbols; Zend-equivalent profile should print ok

./script/docker-exec.sh -- bash -lc 'php -r "var_dump(function_exists(\"mb_trim\"));"; php bin/vm.php -r "var_dump(function_exists(\"mb_trim\"));"'

Done when

  • Default 8.2 reference profile: function_exists false and call fatals/undefined function for all listed builtins
  • PHP_COMPILER_PROFILE=8.4 (or forward profile): builtins register and pass existing forward repros (maintainer_gap_mb_trim_function_exists_forward_84.php, maintainer_gap_crc32c_builtin.php, etc.)
  • Compliance guard under test/compliance/cases/stdlib/profile_gate/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    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 7, 2026
  2. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-b — starting this run

  3. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    Merged via #17212.

    Verification (reference profile):

    • php bin/vm.php test/repro/maintainer_gap_forward_profile_builtin_leak_82.php → ok
    • Zend vs VM: function_exists('mb_trim') both false on unset PHP_COMPILER_PROFILE

    Forward profile preserved:

    • PHP_COMPILER_PROFILE=8.4 repros for mb_trim, crc32c green

    Compliance guard: test/compliance/cases/stdlib/profile_gate/forward_profile_builtin_leak_82.phpt

  4. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  5. PurHur commented on Jul 7, 2026

    @PurHur
    OwnerAuthor

    Merged via #17212 — forward-profile builtins (mb_trim, crc32c, hebrevc, attribute_exists, class_uses_recursive) no longer leak on unset 8.2 reference profile.

    Verification (master):
    ```bash
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_forward_profile_builtin_leak_82.php'

    ok

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "var_dump(function_exists("mb_trim"), function_exists("crc32c"), function_exists("hebrevc"), function_exists("attribute_exists"), function_exists("class_uses_recursive"));"'

    bool(false) x5

    ```

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 machinebugSomething isn't workingenhancementNew 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