MDL-46212 question editing: extra answer fields notice.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 30 Jun 2014 17:58:50 +0000 (18:58 +0100)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Thu, 3 Jul 2014 12:56:11 +0000 (13:56 +0100)
It turns out that PHP does not interpret "$field[$key]" the way we were
expecting.

question/type/edit_question_form.php

index 06ff986..16058ad 100644 (file)
@@ -613,7 +613,7 @@ abstract class question_edit_form extends question_wizard_form {
         foreach ($question->options->answers as $answer) {
             foreach ($extraanswerfields as $field) {
                 // See hack comment in {@link data_preprocessing_answers()}.
-                unset($this->_form->_defaultValues["$field[$key]"]);
+                unset($this->_form->_defaultValues["{$field}[{$key}]"]);
                 $extrafieldsdata[$field][$key] = $this->data_preprocessing_extra_answer_field($answer, $field);
             }
             $key++;