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

Bad string interpolation in the question edit forms

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.7.1
    • 2.7
    • Questions
    • MOODLE_27_STABLE
    • MOODLE_27_STABLE
    • Hide

      2.7 and master

      1. Install qtype_varnumericset.
      2. Create a question of that type, adding at least 6 answers to match
      3. Save the question, then try to edit it again.

      Or, just trust me that I have done those steps, and this is a correct fix.

      In master only

      Here it is a question how much you test now, and how much you assume will be caught by the Moodle 2.8 QA cycle if it is broken.

      A complete test would look like this. I suggest you pick an intelligent sample of this.

      • Preview a quiz.
      • Create then edit a category in the question bank.
      • Create, then edit, then preview, questions of these types (most changed first)
        • calculated
        • calculatedmulti
        • calculatedsimle
        • multianswer
        • numerical
        • essay
        • match
        • shortanswer
        • random short-answer match
      • Import/export questions in these format (again, most necessary to test first.)
        • Moodle XML
        • GIFT
        • webct
        • Blackboard
        • XHTML

      For most of those formats, there is a sample file inside the code, e.g. in question/format/blackboard_six/tests/fixtures

      Show
      2.7 and master Install qtype_varnumericset. Create a question of that type, adding at least 6 answers to match Save the question, then try to edit it again. Or, just trust me that I have done those steps, and this is a correct fix. In master only Here it is a question how much you test now, and how much you assume will be caught by the Moodle 2.8 QA cycle if it is broken. A complete test would look like this. I suggest you pick an intelligent sample of this. Preview a quiz. Create then edit a category in the question bank. Create, then edit, then preview, questions of these types (most changed first) calculated calculatedmulti calculatedsimle multianswer numerical essay match shortanswer random short-answer match Import/export questions in these format (again, most necessary to test first.) Moodle XML GIFT webct Blackboard XHTML For most of those formats, there is a sample file inside the code, e.g. in question/format/blackboard_six/tests/fixtures

      This is a very subtle issue that was only exposed by qtype_varnumericset (add-on) in Moodle 2.7.

      The code was

      unset($this->_form->_defaultValues["$field[$key]"]);
      

      And it turns out that what this does is try to get the $key'th value from string $field, rather than what was expected:

      unset($this->_form->_defaultValues["{$field}[{$key}]"]);
      

            timhunt Tim Hunt
            timhunt Tim Hunt
            Sam Marshall Sam Marshall
            Sam Hemelryk Sam Hemelryk
            Ankit Agarwal Ankit Agarwal
            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.