]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12614 - Bad regular expression matching was causing syntactically
authorpoltawski <poltawski>
Mon, 28 Apr 2008 16:52:50 +0000 (16:52 +0000)
committerpoltawski <poltawski>
Mon, 28 Apr 2008 16:52:50 +0000 (16:52 +0000)
invalid js when returning to previously attempted SCORM package.
Credit to Peter Chamberlin of ljcreate.com

mod/scorm/datamodels/scorm_12.js.php

index 3851062457bde4cbe9b91624c5ef875f90970e12..6e5ceb0cdfb6dcbdb5e838183398af7b292fe63e 100644 (file)
@@ -133,8 +133,8 @@ function SCORMapi1_2() {
     $objectives = '';
     foreach($userdata as $element => $value){
         if (substr($element,0,14) == 'cmi.objectives') {
-            preg_match('/\.(\d+)\./',$element,$matches);
-            $element = preg_replace('/\.(\d+)\./',".\$1.",$element);
+            $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]);