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

Incorrect SQL snippet in qubaids_for_quiz constructor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.1.6, 3.2.3
    • 2.7.19, 2.9.9, 3.0.9, 3.1.5, 3.2.2
    • Quiz
    • MOODLE_27_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • Hide

      To tester: For bonus points you can write a unit testcase for this fix and i'll integrate it (Dan)

      Testing difficulty: Hard(requires writing code to test)

      With a quiz that has completed attempts:

      Construct a query usings the qubaids_for_quiz object with $finishedonly set to true, below is an included snippet that led to finding this bug:

      $qubaids = new qubaids_for_quiz($quizid, false, true);
      $questionids = $DB->get_fieldset_select('question_attempts', 'questionid', 'questionusageid ' . $qubaids->usage_id_in(), $qubaids->usage_id_in_params());

       

      Without the patch it should exhibit a dml exception with the patch you should get a list of question ids.

      Show
      To tester: For bonus points you can write a unit testcase for this fix and i'll integrate it (Dan) Testing difficulty: Hard(requires writing code to test) With a quiz that has completed attempts: Construct a query usings the qubaids_for_quiz object with $finishedonly set to true, below is an included snippet that led to finding this bug: $qubaids = new qubaids_for_quiz($quizid, false, true); $questionids = $DB->get_fieldset_select('question_attempts', 'questionid', 'questionusageid ' . $qubaids->usage_id_in(), $qubaids->usage_id_in_params());   Without the patch it should exhibit a dml exception with the patch you should get a list of question ids.

      When calling new qubaids_for_quiz(int, bool, true) it causes a dml exception when the constructed SQL query is used.

      This has probably never been picked up because core does not seem to call it with $onlyfinished set to true.

            dcocco Darren Cocco
            dcocco Darren Cocco
            Tim Hunt Tim Hunt
            Dan Poltawski Dan Poltawski
            Marina Glancy Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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