Revert "BUGFIX: Replace str_replace with preg_quote"

This reverts commit ec10ce034e.
namespaces
Frode Petterson 2014-02-11 13:47:24 +01:00
parent 7d8d85f450
commit c06123a21e
1 changed files with 1 additions and 1 deletions

View File

@ -1471,7 +1471,7 @@ class H5PContentValidator {
// Check if string is according to optional regexp in semantics // Check if string is according to optional regexp in semantics
if (isset($semantics->regexp)) { if (isset($semantics->regexp)) {
// Escaping '/' found in patterns, so that it does not break regexp fencing. // Escaping '/' found in patterns, so that it does not break regexp fencing.
$pattern = '/' . preg_quote($semantics->regexp->pattern, '/') . '/'; $pattern = '/' . str_replace('/', '\\/', $semantics->regexp->pattern) . '/';
$pattern .= isset($semantics->regexp->modifiers) ? $semantics->regexp->modifiers : ''; $pattern .= isset($semantics->regexp->modifiers) ? $semantics->regexp->modifiers : '';
if (preg_match($pattern, $text) === 0) { if (preg_match($pattern, $text) === 0) {
// Note: explicitly ignore return value FALSE, to avoid removing text // Note: explicitly ignore return value FALSE, to avoid removing text