Skip to content
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]+)',
' ',
(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