Repository navigation
Stdlib: PROFILE<8.4 strcspn empty mask stops at NUL (#27716) - #28952
Merged
Merged
Conversation
Gate GH-12592 binary-safe empty-$characters length behind unset PROFILE / PROFILE≥8.4; explicit PROFILE=8.2 matches Zend 8.2 NUL-stop on VM and JIT. 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
PHP_COMPILER_PROFILE=8.2(and other <8.4) makesstrcspn($haystack, '')stop at an embedded NUL, matching Zend 8.2.PROFILE≥8.4keep Bootstrap: sync M2 spine to 3388/3388 (filter IP + session name shrink) #12592 binary-safe full-segment length (Stdlib: strcspn()/strspn() — PHP 8.4 empty $characters returns full byte length (GH-12592, ext/standard/string.c) #7088 /strcspn_empty_characters_84).VmString::strcspn) + JIT LLVM (phpc_strspn_extendedempty-mask path) share the same gate.Closes #27716
php-src reference
ext/standard/string.c—PHP_FUNCTION(strcspn)/ Bootstrap: sync M2 spine to 3388/3388 (filter IP + session name shrink) #12592 UPGRADINGTest plan
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.2 php bin/vm.php test/repro/issue_27716_strcspn_nul_profile.php && PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_27716_strcspn_nul_profile.php && PHP_COMPILER_PROFILE=8.2 php bin/jit.php test/repro/issue_27716_strcspn_nul_profile.php && PHP_COMPILER_PROFILE=8.4 php bin/jit.php test/repro/issue_27716_strcspn_nul_profile.php'2/3on 8.2,4/3on 8.4 (VM+JIT); default unset still4/3andstrcspn("a\0b","")===3.StrspnRuntimeShrinkTestOK.strcspn_empty_nul_profile82{,_jit}.phpt,strcspn_empty_nul_profile84.phpt.Made with Cursor