MDL-85618 filter_displayh5p: change regular expression delimeter.

Ensure we don't confuse the expression parser when supplied "Allowed
source" contains coincidental control characters in the URL, e.g. '/'
and '#'.

Note that `preg_quote(...)` isn't appropriate here, because the given
URL may indeed contain genuine control characters already.
This commit is contained in:
Paul Holden
2025-08-21 13:00:43 +01:00
parent c1311feeb1
commit 6820464a64
@@ -60,8 +60,8 @@ class text_filter extends \core_filters\text_filter {
'tagend' => '</iframe>',
];
$specialchars = ['?', '&'];
$escapedspecialchars = ['\?', '&amp;'];
$specialchars = ['~', '?', '&'];
$escapedspecialchars = ['\~', '\?', '&amp;'];
$h5pcontents = [];
$h5plinks = [];
@@ -103,7 +103,7 @@ class text_filter extends \core_filters\text_filter {
$params + ['ish5plink' => false]
);
$h5pcontenturl->workregexp = '#' . $ultimatepattern . '#';
$h5pcontenturl->workregexp = '~' . $ultimatepattern . '~';
$h5pcontents[] = $h5pcontenturl;
// Regex to find h5p extensions in an <a> tag.