verify: quote the regexp before using them

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3858 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-08-01 13:40:12 +00:00
parent e56e19215f
commit 3bda16ce6c

View File

@@ -409,7 +409,8 @@ class verify
*/
public static function staticIsAllowedChars ($val, $allowedChars)
{
preg_match ('/^['.$allowedChars.']+/u', $val, $matches);
$allowedChars = preg_quote ($allowedChars, "#");
preg_match ('#^['.$allowedChars.']+#u', $val, $matches);
if (isset ($matches[0]) &&
mb_strlen ($matches[0]) === mb_strlen ($val))
return true;