diff --git a/h5p/classes/helper.php b/h5p/classes/helper.php index e88fe63bc55..f79c761dcfb 100644 --- a/h5p/classes/helper.php +++ b/h5p/classes/helper.php @@ -409,6 +409,8 @@ class helper { * @return array The JS array converted to PHP array. */ public static function parse_js_array(string $jscontent): array { + // Convert all line-endings to UNIX format first. + $jscontent = str_replace(array("\r\n", "\r"), "\n", $jscontent); $jsarray = preg_split('/,\n\s+/', substr($jscontent, 0, -1)); $jsarray = preg_replace('~{?\\n~', '', $jsarray);