-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Labels
BugFormGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.Status: Needs Review
Description
Symfony version(s) affected: 4.4.16
Description
StringUtil::trim()
is doing preg_replace('/^[\pZ\p{Cc}]+|[\pZ\p{Cc}]+$/u', '', $string)
to trim strings, however this regex is missing ZERO WIDTH SPACE (\xE2\x80\x8B) characters.
How to reproduce
http://sandbox.onlinephpfunctions.com/code/5b72e8ff76c34a313c0f2799995f56e5993b6b60
Possible Solution
p{Cf}
catches this character, but it also catches some soft-hyphen (https://en.wikipedia.org/wiki/Unicode_character_property). I don't think that should be a problem though.
I suggest the regex to be changed to preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $string)
.
Cc
and Cf
are the only categories with characters in the C
group anyway.
Metadata
Metadata
Assignees
Labels
BugFormGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.Status: Needs Review