[Form] Fixed StringUtil::trim() to trim ZERO WIDTH SPACE (U+200B) and SOFT HYPHEN (U+00AD)
This commit is contained in:
parent
bda2dcdf93
commit
258bea7fd5
@ -72,7 +72,9 @@ class StringUtilTest extends TestCase
|
|||||||
['000D'],
|
['000D'],
|
||||||
['0085'],
|
['0085'],
|
||||||
// zero width space
|
// zero width space
|
||||||
// ['200B'],
|
['200B'],
|
||||||
|
// soft hyphen
|
||||||
|
['00AD'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class StringUtil
|
|||||||
*/
|
*/
|
||||||
public static function trim($string)
|
public static function trim($string)
|
||||||
{
|
{
|
||||||
if (null !== $result = @preg_replace('/^[\pZ\p{Cc}]+|[\pZ\p{Cc}]+$/u', '', $string)) {
|
if (null !== $result = @preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $string)) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user