From ec10ce034ec31f557a860bdee2b51794addf667c Mon Sep 17 00:00:00 2001 From: Frank Ronny Larsen Date: Wed, 18 Dec 2013 11:32:57 +0100 Subject: [PATCH] BUGFIX: Replace str_replace with preg_quote --- h5p.classes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/h5p.classes.php b/h5p.classes.php index b73b788..b734c1a 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1464,7 +1464,7 @@ class H5PContentValidator { // Check if string is according to optional regexp in semantics if (isset($semantics->regexp)) { // Escaping '/' found in patterns, so that it does not break regexp fencing. - $pattern = '/' . str_replace('/', '\\/', $semantics->regexp->pattern) . '/'; + $pattern = '/' . preg_quote($semantics->regexp->pattern, '/') . '/'; $pattern .= isset($semantics->regexp->modifiers) ? $semantics->regexp->modifiers : ''; if (preg_match($pattern, $text) === 0) { // Note: explicitly ignore return value FALSE, to avoid removing text