Commit 15ddb76d authored by Bas de Nooijer's avatar Bas de Nooijer Committed by Dorian Villet

Fix for issue #180

parent 427dbf37
...@@ -479,4 +479,17 @@ class Helper ...@@ -479,4 +479,17 @@ class Helper
return $result; return $result;
} }
/**
* Filters control characters that cause issues with servlet containers.
*
* Mainly useful to filter data before adding it to a document for the update query.
*
* @param $data
* @return mixed
*/
public function filterControlCharacters($data)
{
return preg_replace('@[\x00-\x08\x0B\x0C\x0E-\x1F]@', ' ', $data);
}
} }
...@@ -404,4 +404,12 @@ class HelperTest extends \PHPUnit_Framework_TestCase ...@@ -404,4 +404,12 @@ class HelperTest extends \PHPUnit_Framework_TestCase
); );
} }
public function testFilterControlCharacters()
{
$this->assertEquals(
'my string',
$this->helper->filterControlCharacters("my\x08string")
);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment