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

gapselect: apparent typo in code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5.3
    • Fix Version/s: 3.5.4, 3.6.1
    • Component/s: Questions
    • Labels:

      Description

      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]']);

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            daniel@edunao.com Daniel Miller
            Peer reviewer:
            Luca Bösch
            Integrator:
            Damyon Wiese
            Tester:
            Damyon Wiese
            Participants:
            Component watchers:
            Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              5/Dec/18