Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31248: Fixed handling non-printable characters for Search #2904

Merged
merged 10 commits into from
May 6, 2020
11 changes: 9 additions & 2 deletions eZ/Publish/Core/Search/Common/FieldValueMapper/StringMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,16 @@ public function map(Field $field)
*/
protected function convert($value)
{
// Remove non-printable characters
// Replace tab, vertical tab, form-feed chars to single space.
$value = preg_replace(
'([\x09\x0B\x0C]+)',
mateuszbieniek marked this conversation as resolved.
Show resolved Hide resolved
' ',
(string)$value
);

// Remove non-printable characters (except LF and CR).
return preg_replace(
'([\x00-\x09\x0B\x0C\x1E\x1F]+)',
'([\x00-\x08\x0E-\x1F]+)',
'',
(string)$value
);
Expand Down