From 5ca9e32d979cdb881511cfd74d412c5107f51629 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 3 Jul 2008 14:50:30 +0000 Subject: [PATCH] MDL-13010 Now correctly checks for category context id and does not fail if it isn't there. Merged from STABLE_19 --- question/format.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/question/format.php b/question/format.php index 1ec5ad46e1..ad5a9d4b5f 100644 --- a/question/format.php +++ b/question/format.php @@ -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 { -- 2.39.5