diff --git a/questiontype.php b/questiontype.php index 9d0455d..a739442 100755 --- a/questiontype.php +++ b/questiontype.php @@ -158,7 +158,7 @@ protected function initialise_question_instance(question_definition $question, $ $r = substr($question->delimitchars, 1, 1); $nongapregex = '/\\' . $l . '.*?\\' . $r . '/'; - $nongaptext = preg_split($nongapregex, $question->questiontext, null, PREG_SPLIT_DELIM_CAPTURE); + $nongaptext = preg_split($nongapregex, $question->questiontext, -1, PREG_SPLIT_DELIM_CAPTURE); $i = 0; while (!empty($nongaptext)) { $question->textfragments[$i] = array_shift($nongaptext); diff --git a/renderer.php b/renderer.php index 239acac..080f56d 100755 --- a/renderer.php +++ b/renderer.php @@ -170,7 +170,7 @@ public function embedded_element(question_attempt $qa, $place, question_display_ $question = $qa->get_question(); $fieldname = $question->field($place); - $currentanswer = $qa->get_last_qt_var($fieldname); + $currentanswer = $qa->get_last_qt_var($fieldname) ?? ''; $currentanswer = htmlspecialchars_decode($currentanswer); $rightanswer = $question->get_right_choice_for($place); $itemsettings = $this->get_itemsettings($rightanswer);