]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12614 - Bad regular expression matching was causing syntactically
authorpoltawski <poltawski>
Wed, 30 Apr 2008 11:59:41 +0000 (11:59 +0000)
committerpoltawski <poltawski>
Wed, 30 Apr 2008 11:59:41 +0000 (11:59 +0000)
invalid js when returning to previously attempted SCORM package.

Credit to Peter Chamberlin of ljcreate.com
merged from MOODLE_19_STABLE

mod/scorm/datamodels/scorm_13.js.php

index fffd175ec4e27e7124a9b88abc8fa62a8796ba90..dba2a5795f74dd704493becd76df4c4b4d6c9886 100644 (file)
@@ -210,9 +210,9 @@ function SCORMapi1_3() {
     $objectives = '';
     foreach($userdata as $element => $value){
         if (substr($element,0,14) == 'cmi.objectives') {
-            preg_match('/\.(\d+)\./',$element,$matches);
-            $element = preg_replace('/\.(\d+)\./',".N\$1.",$element);
-            if ($matches[1] == $count) {
+            $element = preg_replace('/\.(\d+)\./', "_\$1.", $element);
+            preg_match('/_(\d+)\./', $element, $matches);
+            if (isset($matches[1]) && $matches[1] == $count) {
                 $count++;
                 $end = strpos($element,$matches[1])+strlen($matches[1]);
                 $subelement = substr($element,0,$end);