From d1673b8f6c77a42b3eef38c7d362781e30a5a788 Mon Sep 17 00:00:00 2001
From: Dan Marsden <dan@danmarsden.com>
Date: Thu, 9 Jul 2015 16:35:20 +1200
Subject: [PATCH] MDL-49647 mod_scorm: correct escaping of javascript content.

---
 mod/scorm/locallib.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php
index 13f09ce..d76312f 100644
--- a/mod/scorm/locallib.php
+++ b/mod/scorm/locallib.php
@@ -1092,7 +1092,7 @@ function scorm_reconstitute_array_element($sversion, $userdata, $elementname, $c
             $return .= '    '.$subelement." = new Object();\n";
         }
 
-        $return .= '    '.$element.' = \''.$value."';\n";
+        $return .= '    '.$element.' = '.json_encode($value).";\n";
     }
     if ($countsub > 0) {
         $return .= '    '.$elementname.$scormseperator.$current.'.'.$currentsubelement.'._count = '.$countsub.";\n";
-- 
2.1.4

