From d9e9e799541160cf034ddd3293548502b5de0c03 Mon Sep 17 00:00:00 2001 From: Mark Nielsen Date: Tue, 7 Oct 2014 11:47:40 -0700 Subject: [PATCH 1/2] MDL-47569 backup: Escape section summary for XML This was causing the parsing of the XML to fail because things like & were not escaped. --- backup/cc/cc2moodle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup/cc/cc2moodle.php b/backup/cc/cc2moodle.php index 332a9562185..0728daca872 100644 --- a/backup/cc/cc2moodle.php +++ b/backup/cc/cc2moodle.php @@ -338,7 +338,7 @@ class cc2moodle { $replace_values = array($i, $i - 1, - $topic['title'], + entities::safexml($topic['title']), $node_node_course_sections_section_mods_mod); } else { From 3315c01e0f2ea35bad68f03dbc0478708df559f6 Mon Sep 17 00:00:00 2001 From: Mark Nielsen Date: Tue, 7 Oct 2014 11:48:35 -0700 Subject: [PATCH 2/2] MDL-47569 backup: Do not close questions tag if never opened This can happen when restoring quizzes that do not have any questions. --- backup/converter/moodle1/handlerlib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backup/converter/moodle1/handlerlib.php b/backup/converter/moodle1/handlerlib.php index 5265fa01593..bbdfd7f97fb 100644 --- a/backup/converter/moodle1/handlerlib.php +++ b/backup/converter/moodle1/handlerlib.php @@ -1292,7 +1292,9 @@ class moodle1_question_bank_handler extends moodle1_xml_handler { * Closes the questions wrapper */ public function on_questions_end() { - $this->xmlwriter->end_tag('questions'); + if ($this->questionswrapperwritten) { + $this->xmlwriter->end_tag('questions'); + } } /**