Skip to content

Regression: lcfirst/ucwords/wordwrap/strtr/str_ireplace — enum case operands coerce (re-#6003, #5889, string.c) #8742

Closed

Description

@PurHur

Category

stdlib — regression

Problem

String transform builtins must TypeError on enum case operands (php-src ext/standard/string.c). Closed #6003 / #5889 added guards, but VM still coerces backed enum cases to strings and runs the builtin.

Affected: lcfirst(), ucwords(), wordwrap(), strtr(), str_ireplace().

php-src reference

Repro

test/repro/maintainer_string_transform_enum.php:

php test/repro/maintainer_string_transform_enum.php
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_string_transform_enum.php'
Builtin Zend VM today
lcfirst(ES::Hello) TypeError no_error → 'hello'
ucwords(ES::HelloWorld) TypeError no_error
wordwrap(ES::Plain) TypeError no_error
strtr(ES::Plain, 'l', 'L') TypeError no_error
str_ireplace('h','H', ES::Hello) TypeError no_error

Scope

  • ext/standard/lcfirst.php, ucwords.php, wordwrap.php, strtr.php, str_ireplace.php
  • Shared guards: VmString::coerceStringBuiltinArg, JitStringBuiltinArg
  • JIT/AOT must match VM

Done when

  • All five builtins TypeError on enum cases (VM + JIT/AOT)
  • Repro prints five TypeError lines on VM
  • ./script/ci-fast.sh --filter StringTransformEnum or targeted compliance PHPT green
  • php-src-strict

Links

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 Jun 15, 2026
  2. PurHur commented on Jun 15, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. PurHur commented on Jun 23, 2026

    @PurHur
    OwnerAuthor

    Stale-close candidate (lane A audit 2026-06-23): repro green on master — see verification table on #1492. Recommend close.

  4. PurHur commented on Jun 23, 2026

    @PurHur
    OwnerAuthor

    Closing: repro green on master (lane A verification 2026-06-23). See #10290 audit.

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 apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions