Moodle
  1. Moodle
  2. MDL-31814

Edit a Quiz: Question Bank Contents Block has Undefined Index

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor 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

          Activity

          Hide
          Jozek Wozny added a comment -

          I have the same problem

          Please help

          Show
          Jozek Wozny added a comment - I have the same problem Please help
          Hide
          Tim Hunt added a comment -

          I think this fix is better than the one proposed in the work-around. However, I am still unable to reproduce this bug myself, so I would be really grateful if someone who is suffering from this bug could test the proposed fix.

          Show
          Tim Hunt added a comment - I think this fix is better than the one proposed in the work-around. However, I am still unable to reproduce this bug myself, so I would be really grateful if someone who is suffering from this bug could test the proposed fix.
          Hide
          Dan Poltawski added a comment -

          Looks fine here, but also can't reproduce

          Show
          Dan Poltawski added a comment - Looks fine here, but also can't reproduce
          Hide
          Tim Hunt added a comment -

          After a weekend to think about this, I am still confident this is the right solution, so submitting for integration now.

          Show
          Tim Hunt added a comment - After a weekend to think about this, I am still confident this is the right solution, so submitting for integration now.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Dan Poltawski added a comment -

          Thanks Tim - i've integrated this now

          Show
          Dan Poltawski added a comment - Thanks Tim - i've integrated this now
          Hide
          Rajesh Taneja added a comment -

          Works Great
          Thanks for fixing this, Tim.

          Show
          Rajesh Taneja added a comment - Works Great Thanks for fixing this, Tim.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          U P S T R E A M I Z E D !

          Many thanks for the hard work, closing this as fixed.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - U P S T R E A M I Z E D ! Many thanks for the hard work, closing this as fixed. Ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: