Skip to content

Regression: StringTrimMode phantom on PROFILE≥8.4 — absent from php-src (re-#7283, ext/standard/string.stub.php) #28202

Closed

Description

@PurHur

Category

bug · php-src-strict · builtin stub enums · pillar 4

Problem

Under PHP_COMPILER_PROFILE=8.4 / 8.5, VM registers int-backed enum StringTrimMode (Both/Left/Right) for trim()/ltrim()/rtrim() (#7283). php-src has no StringTrimMode — those builtins take string $characters = " \n\r\t\v\0" only (no mode enum parameter).

Probed 2026-08-06 @ 12bda25e052b.

Repro Zend php-src 8.4+ VM PROFILE=8.4
enum_exists('StringTrimMode') false true
StringTrimMode::cases() n/a Both,Left,Right

php-src reference

PHP implementation target

  • ext/standard/BuiltinEnums.php::registerStringTrimMode — withhold under php-src-strict
  • ext/standard/VmString.php (tryStringTrimModeBitmask) — do not accept enum mode on php-src-strict
  • lib/JIT/Builtin/StringTrimModeJit.php — gate enum path
  • PHP-in-PHP; no C runtime growth

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/stringtrimmode_phantom.php <<"PHP"
<?php
echo "enum_exists=", enum_exists("StringTrimMode") ? "true" : "false", "\n";
PHP
PHP_COMPILER_PROFILE=8.4 php bin/vm.php /tmp/stringtrimmode_phantom.php'
# Expect: enum_exists=false

Done when

  • enum_exists('StringTrimMode') is false on PROFILE 8.4/8.5
  • trim/ltrim/rtrim match Zend arity/types
  • Compliance/test/repro guard; php-src-strict

Activity

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

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

    Retiring phantom StringTrimMode under php-src-strict (re-#7283), restoring Zend arity for trim/ltrim/rtrim (also closes #28230 call-site observable). Pattern: #28203/#28218 SessionStatus.

    Trust probe (this host): php script/bootstrap-inventory.php --check → OK 7168/7168. release-readiness still running.

  3. PurHur commented on Aug 8, 2026

    @PurHur
    OwnerAuthor

    unclaim: stale claim (~33h, no open PR, no agent/*/fix/* branch on the remote — only master remains). Returning to implementation-ready for a fresh worker.

    Cleanup bot: paired with #28230 (same phantom $mode / StringTrimMode retirement). No evidence of landed work for this claim.

  4. PurHur commented on Aug 8, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch replacement after #27827 already-fixed (issues #28202, #28230)

    Root cause: phantom StringTrimMode + 3rd $mode on trim/ltrim/rtrim. One PR closes both (#28202 enum, #28230 ArgumentCountError).

  5. PurHur commented on Aug 8, 2026

    @PurHur
    OwnerAuthor

    Merged #28959

    Verification: PHP_COMPILER_PROFILE=8.4 Zend/VM/JIT — enum_exists('StringTrimMode')===false; trim(' x ',' ',true) → ArgumentCountError: … at most 2 arguments, 3 given. Unit + advertisement guard green.

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 workingimplementation-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