Commit e33e7915 authored by Bas de Nooijer's avatar Bas de Nooijer

Fix for issue #180

parent 504cf43d
......@@ -479,4 +479,17 @@ class Helper
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
);
}
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