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

Edit a Quiz: Question Bank Contents Block has Undefined Index

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.1.7, 2.2.4
    • Component/s: Quiz
    • Labels:
    • Environment:
      Ubuntu 10.04.4
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      You need a course with questions.

      1. Go to Course settings -> Question bank. Make sure the list of questions displays with no errors.
      2. Change the sort order of the the questions bank, and some of the other options that affect the display, and make sure there are no errors.

      3. Repeat 1. & 2. for Quiz settings -> Question bank.

      4. Repeat 1. & 2. for the display of the question bank inside Quiz settings -> Edit quiz.

      Show
      You need a course with questions. 1. Go to Course settings -> Question bank. Make sure the list of questions displays with no errors. 2. Change the sort order of the the questions bank, and some of the other options that affect the display, and make sure there are no errors. 3. Repeat 1. & 2. for Quiz settings -> Question bank. 4. Repeat 1. & 2. for the display of the question bank inside Quiz settings -> Edit quiz.
    • Workaround:
      Hide

      For /question/editlib.php, in the build_query_sql() function, I added an IF statement that does an isset() on an index to make sure it exists before attempting to make use of that index. Thusly...

      if (isset($this->requiredcolumns[$colname])) { /* This IF condition is a patched workaround */
      $sorts[] = $this->requiredcolumns[$colname]->sort_expression($order < 0, $subsort);
      }

      Show
      For /question/editlib.php, in the build_query_sql() function, I added an IF statement that does an isset() on an index to make sure it exists before attempting to make use of that index. Thusly... if (isset($this->requiredcolumns [$colname] )) { /* This IF condition is a patched workaround */ $sorts[] = $this->requiredcolumns [$colname] ->sort_expression($order < 0, $subsort); }
    • URL:
      /mod/quiz/edit.php?cmid=999
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      With Moodle 2.2.1, went to edit a quiz and the Question Bank Contents Block got this error message:

      Notice: Undefined index: questionname in /var/www/moodle/test/question/editlib.php on line 1105 Fatal error: Call to a member function sort_expression() on a non-object in /var/www/moodle/test/question/editlib.php on line 1105

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  9/Jul/12