From: poltawski Date: Mon, 28 Apr 2008 16:52:50 +0000 (+0000) Subject: MDL-12614 - Bad regular expression matching was causing syntactically X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2385bf068680353269b67f3b82a584a825f8f1a6;p=moodle.git MDL-12614 - Bad regular expression matching was causing syntactically invalid js when returning to previously attempted SCORM package. Credit to Peter Chamberlin of ljcreate.com --- diff --git a/mod/scorm/datamodels/scorm_12.js.php b/mod/scorm/datamodels/scorm_12.js.php index 3851062457..6e5ceb0cdf 100644 --- a/mod/scorm/datamodels/scorm_12.js.php +++ b/mod/scorm/datamodels/scorm_12.js.php @@ -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]);