Skip to content

Commit

Permalink
MDL-71343 core_h5p: Convert all line-endings to UNIX format
Browse files Browse the repository at this point in the history
  • Loading branch information
rjnl committed Apr 30, 2021
1 parent 9a4a49f commit c217daf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions h5p/classes/helper.php
Expand Up @@ -409,6 +409,8 @@ public static function get_cache_librarykey(string $library): string {
* @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);

Expand Down

0 comments on commit c217daf

Please sign in to comment.