From b85c0bee53d4bff467abbb55880c6a83b0cb9e59 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 30 Nov 2012 11:28:38 +0000 Subject: [PATCH] MDL-36942 xml question import: don't add spaces. They are not necessary anyway, there is a \n character at the end of each line. Thanks to Richard Lobb for fining the problem and how to fix it. --- question/format/xml/format.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 24ce21afbbd..deb913c6267 100644 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -904,17 +904,18 @@ class qformat_xml extends qformat_default { */ protected function readquestions($lines) { // We just need it as one big string - $text = implode($lines, ' '); - unset($lines); + $lines = implode('', $lines); // This converts xml to big nasty data structure // the 0 means keep white space as it is (important for markdown format) try { - $xml = xmlize($text, 0, 'UTF-8', true); + $xml = xmlize($lines, 0, 'UTF-8', true); } catch (xml_format_exception $e) { $this->error($e->getMessage(), ''); return false; } + unset($lines); // No need to keep this in memory. + // Set up array to hold all our questions $questions = array();