Cover CJK and four-byte characters in the filename tests - #39
Merged
Conversation
No test anywhere under tests/ carried a Han ideograph, kana or Hangul syllable, and the only four-byte character was an emoji in the display sanitizer's provider, so nothing drove one through setName(). The straddle rows are the ones with a branch behind them. forceValidUtf8() matches an incomplete tail with a separate alternative per width, and a byte cut can leave a three-byte character with one or two bytes and a four-byte one with up to three. The single two-byte case that was there exercised one of those alternatives. The rows land on mb_strcut() where ext-mbstring is loaded and on substr() plus the repair in the polyfill job, which runs the mbstring group rather than excluding it and ships no mb_strcut(). Rows 88 and 89 sit in the provider every configuration runs: a character ending on the budget survives a byte cut unchanged, so the expected value holds without the repair. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Nothing under
tests/carried a Han ideograph, kana or Hangul syllable, and the only four-byte character was an emoji inFilenameTest::provideInvalidUtf8ToSanitize— the display sanitizer's provider — so no four-byte character was ever driven throughsetName().Adds 26 tests. No source change.
providerSetNameSanitizing— runs in every mbstring configuration聊天(PC)-201711201615.xlsx, CJK mixed with the ASCII punctuation the rewriter does touchファイル名.txt파일이름.txt𠮟𪚲.txt, four-bytephoto😀.png, four-byte文字(v2).文— an extension is ASCII alphanumeric or discarded wholeRow 82 is the shape a client name off a CJK desktop arrives in: three-byte characters either side of parentheses the rewriter turns into
-. Nothing tested that combination.providerSetNameSanitizingRequiringMbstring—@group mbstringEvery offset at which a wider character can straddle the truncation cut: pads 248 and 249 for a three-byte character, 247 through 249 for a four-byte one. The provider had one two-byte case at pad 249.
This is the half with a branch behind it.
forceValidUtf8()matches an incomplete tail with a separate alternative per width —[\xE0-\xEF][\x80-\xBF]?and[\xF0-\xF4][\x80-\xBF]{0,2}— and the one existing case exercised neither. The rows land on different code by configuration:ext-mbstringloaded —mb_strcut()refuses to split the character, so they test its boundary handling.mbstring polyfilljob — that job runs without--exclude-group, and the polyfill ships nomb_strcut(), sofinalize()falls tosubstr()and the repair strips the partial sequence.Rows 88 and 89 are in the plain provider on purpose: a character ending on a byte boundary survives a byte cut unchanged, so the expected value holds with no repair and every configuration can run them. Verified against the
substr()path rather than assumed.Checks
cross-file-system's--fail-on-skippedguard is intact.lint,phpstan(level 9) andcheck-syntaxclean.mb_strcut→mb_substrfails 16 tests, adding\x80-\xFFto the unsafe-character class fails 62.No
CHANGELOG.mdentry — test-only, andtests/isexport-ignored.Run locally with
ext-mbstringloaded. The polyfill and no-mbstring configurations are CI-only.🤖 Generated with Claude Code