Zend_Filter_StringTrim does not work correctly with UTF-8

0 like 0 dislike
It was found that the filter for the trimming of strings though, and declares "Unicode aware trim method", but not that he is "aware trim". If it gets a string ending with the Cyrillic uppercase "R", it deteriorates. Probably because its representation in UTF-8 ends at A0.

Specifically, a problem emerges here in the regular season:

preg_replace('/^[\\s]*|[\\s]*$/sSD', ", $value)

If you add the u modifier, the result is generally NULL.

No such problem is encountered?
by | 36 views

2 Answers

0 like 0 dislike
PHP 5.2.10, 5.3.3 — add a u flag solves the problem. Regarding his absence, it makes sense to write a bug report.
By the way, the usual native PHP trim() function when used without the second argument (or if the non-ASCII characters in it) is completely safe for UTF-8 strings.
0 like 0 dislike
If you add the u modifier, the result is generally NULL.

just checked. with this modifier the regular season works fine. without him and really observed the jamb with a capital R, but it is okay
version php 5.3.1

Related questions

0 like 0 dislike
3 answers
asked May 20, 2019 by Pavel_White
0 like 0 dislike
1 answer
asked Apr 4, 2019 by Vasiliy_M
110,608 questions
257,187 answers
40,796 users