Repository navigation
Fix service name formatter deleting tabs/newlines instead of collapsing them - #51
Closed
kayjoosten wants to merge 1 commit into
Closed
kayjoosten wants to merge 1 commit into
kayjoosten wants to merge 1 commit into
Conversation
…ng them Control-character stripping ran before whitespace collapsing, so a tab or newline between words (itself a control character) was deleted outright instead of being normalized to a single space, joining adjacent words together. Swap the order so whitespace is collapsed first, then remaining control/format characters are stripped.
Contributor
Author
|
Closing - fix has been pushed directly to feature/issue-48-preserve-mdui-uiinfo instead (see PR #49). |
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.
Problem
While testing the service name display feature, a service name containing a tab or newline between words (e.g. "Name\tWith") rendered as concatenated words ("NameWith") instead of a single space ("Name With").
Root cause
ServiceNameFormatter::format()stripped control/format characters (\p{Cc}\p{Cf}) before collapsing whitespace (\s+) to a single space. Since a tab or newline is itself a control character, it was deleted outright in the first pass instead of ever reaching the whitespace-collapse pass.Fix
Swapped the order of the two regex passes: whitespace is now collapsed to a single space first, then remaining non-whitespace control/format characters (e.g. zero-width space, BEL) are stripped with no replacement.
Testing
Added regression tests for tab-between-words and newline-between-words. Full suite (43/43) and phpstan pass.