Closed
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.