Skip to content

Stdlib: retire phantom StringTrimMode; trim arity ≤2 (#28202, #28230) - #28959

Merged
PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-28202-string-trim-mode-phantom
Aug 8, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-28202-string-trim-mode-phantom

Conversation

@PurHur

@PurHur PurHur commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #28202
Closes #28230

php-src reference

  • ext/standard/string.stub.php — trim/ltrim/rtrim (2 params)
  • ext/standard/string.c — php_trim

Test plan

  • Repro Zend/VM/JIT PROFILE=8.4:
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_28202_28230_string_trim_mode.php && PHP_COMPILER_PROFILE=8.4 php bin/jit.php test/repro/issue_28202_28230_string_trim_mode.php'
    → ArgumentCountError:trim() expects at most 2 arguments, 3 given + enum=0
  • StringTrimModeEnumTest OK; testVmDoesNotRegisterStringTrimModeOnForwardProfile84 OK
  • Normal trim(' x ') / trim('xxhi','x') still work; ltrim/rtrim 3-arg also ArgumentCountError

Note: branch pushed via GitHub Git Data API after git-receive-pack hung on this host.

Made with Cursor

php-src never ships StringTrimMode; trim/ltrim/rtrim take at most two
arguments. Stop registering the stub enum and restore ArgumentCountError
on a 3rd positional arg (sibling of MemoryUsage/ExitStatus retirements).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant