]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-13010
authorthepurpleblob <thepurpleblob>
Thu, 3 Jul 2008 14:50:30 +0000 (14:50 +0000)
committerthepurpleblob <thepurpleblob>
Thu, 3 Jul 2008 14:50:30 +0000 (14:50 +0000)
Now correctly checks for category context id and does not fail if it isn't there.

Merged from STABLE_19

question/format.php

index 1ec5ad46e170f450603bcda7a7965ed40c186749..ad5a9d4b5f19bcbd66183fa5cb05ce7b96eba086 100644 (file)
@@ -359,7 +359,10 @@ class qformat_default {
         $catnames = explode($delimiter, $catpath);
         $parent = 0;
         $category = null;
-        if (FALSE !== preg_match('/^\$([a-z]+)\$$/', $catnames[0], $matches)){
+        
+        // check for context id in path, it might not be there in pre 1.9 exports
+        $matchcount = preg_match('/^\$([a-z]+)\$$/', $catnames[0], $matches);
+        if ($matchcount==1) {
             $contextid = $this->translator->string_to_context($matches[1]);
             array_shift($catnames);
         } else {