Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64286

gapselect: apparent typo in code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.5.4, 3.6.1
    • 3.5.3
    • Questions

      Looking at the code here:
      https://github.com/moodle/moodle/blob/master/question/type/gapselect/edit_form_base.php

      Around line 227 One sees the following code:
       

      protected function data_preprocessing_choice($question, $answer, $key) {
          // See comment in data_preprocessing_answers.
          unset($this->_form->_defaultValues['choices[$key][choicegroup]']);
          $question->choices[$key]['answer'] = $answer->answer;
          $question->choices[$key]['choicegroup'] = $answer->feedback;
          return $question;

      Note the use of single quotes in the line:
      unset($this->_form->_defaultValues['choices[$key][choicegroup]']);

      This looks wrong because the $key won't be expanded.

      Presumably this should either use double quotes or the following form:
      unset($this->_form->_defaultValues['choices[' . $key . '][choicegroup]']);

            timhunt Tim Hunt
            daniel@edunao.com Daniel Miller
            Luca Bösch Luca Bösch
            Damyon Wiese Damyon Wiese
            Damyon Wiese Damyon Wiese
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.