Repository navigation
Stdlib: retire phantom StringTrimMode; trim arity ≤2 (#28202, #28230) - #28959
Merged
PurHur merged 1 commit intoAug 8, 2026
Merged
Conversation
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>
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StringTrimModeundersupportsBuiltinStubEnums()— php-src never ships it (Regression: StringTrimMode phantom on PROFILE≥8.4 — absent from php-src (re-#7283, ext/standard/string.stub.php) #28202, re-Stdlib: StringTrimMode enum — PHP 8.4 trim()/ltrim()/rtrim() side parameter missing (string.c) #7283).trim/ltrim/rtrim/chopat arity 2; 3rd positional arg →ArgumentCountErrorlike Zend (Regression: trim/ltrim/rtrim 3rd arg TypeError under PROFILE≥8.4 — Zend ArgumentCountError (re-#23224, ext/standard/string.c) #28230).resolveTrimMaskAndMode+ JIT lowering (no mode enum path). Sibling of MemoryUsage/ExitStatus retirements.Closes #28202
Closes #28230
php-src reference
ext/standard/string.stub.php—trim/ltrim/rtrim(2 params)ext/standard/string.c—php_trimTest plan
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=0StringTrimModeEnumTestOK;testVmDoesNotRegisterStringTrimModeOnForwardProfile84OKtrim(' x ')/trim('xxhi','x')still work; ltrim/rtrim 3-arg also ArgumentCountErrorNote: branch pushed via GitHub Git Data API after
git-receive-packhung on this host.Made with Cursor