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

Quiz with random questions from the system question bank breaks after upgrade to Moodle 5.0

    • MOODLE_500_STABLE
    • MDL-85210_500_STABLE
    • MDL-85210_main
    • Hide

      Steps to reproduce:
      1. Install a fresh Moodle 4.5 using the MOODLE_405_STABLE branch.
      2. Go to the site homepage and select "Question bank"
      3. Add a new True/False question in the "Default for system" category.
      4. Create a new course
      5. Create a quiz in this course
      6. Add a random question to the quiz. Set the category filter to "Top for system" with "Also show questions from subcategories" checked.

      • Confirm that the random question is shown on the quiz's Questions page.

      7. Upgrade to Moodle 5 using the attached MDL-85210_main branch.
      8. Run cron (there's an adhoc task that need to be run after site upgrade)
      9. Return to the quiz's Questions page.

      • Confirm that the random question is shown on the quiz's Questions page.
      • Confirm no errors are displayed.
      Show
      Steps to reproduce: 1. Install a fresh Moodle 4.5 using the MOODLE_405_STABLE branch. 2. Go to the site homepage and select "Question bank" 3. Add a new True/False question in the "Default for system" category. 4. Create a new course 5. Create a quiz in this course 6. Add a random question to the quiz. Set the category filter to "Top for system" with "Also show questions from subcategories" checked. Confirm that the random question is shown on the quiz's Questions page. 7. Upgrade to Moodle 5 using the attached MDL-85210 _main branch. 8. Run cron (there's an adhoc task that need to be run after site upgrade) 9. Return to the quiz's Questions page. Confirm that the random question is shown on the quiz's Questions page. Confirm no errors are displayed.
    • Hide

      Code verified against automated checks.

      Checked MDL-85210 using repository: https://github.com/marxjohnson/moodle.git

      More information about this report

      Built on: Wed Jun 11 07:57:41 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-85210 using repository: https://github.com/marxjohnson/moodle.git MOODLE_500_STABLE (0 errors / 0 warnings) [branch: MDL-85210_500_STABLE | CI Job ] main (0 errors / 0 warnings) [branch: MDL-85210_main | CI Job ] More information about this report Built on: Wed Jun 11 07:57:41 UTC 2025

      Steps to reproduce:

      1. Install a fresh Moodle 4.5
      2. Create two questions in the category "Default for system"
      3. Create a new course
      4. Create a quiz in this course
      5. Add a random questions to the quiz. Set the category filter to "Top for system" with "Also show questions from subcategories" checked.
      6. Upgrade to Moodle 5
      7. Run cron (there's an adhoc task that need to be run after site upgrade)
      8. Enable warnings (level at least to NORMAL) and enable displaying those.
      9. Go to the quiz-settings of the quiz of step 4 and go to tab "Questions"

      Expected behaviour:

      View the two random questions in the question list.

      Actual behavoiur:

      See "Missing question categories" at the questions and see some PHP-Warnings:

      Warning: Attempt to read property "cminfo" on null in /var/www/moodle_v5/bug_repro/mod/quiz/classes/output/edit_renderer.php on line 1131
      Warning: Attempt to read property "id" on null in /var/www/moodle_v5/bug_repro/mod/quiz/classes/output/edit_renderer.php on line 1131 

      Additionally, clicking on "See questions" next to the random question also results in an error:

      Invalid course module ID
       
      More information about this error
      Debug info:
      Error code: invalidcoursemodule
      Stack trace:
       
          line 42 of /question/editlib.php: core\exception\moodle_exception thrown
          line 255 of /question/editlib.php: call to get_module_from_cmid()
          line 155 of /question/editlib.php: call to question_build_edit_resources()
          line 39 of /question/edit.php: call to question_edit_setup()
      

      Screenshots: see attachment.

       

      Used system: Debian 12.10 with PHP 8.2.28 and MariaDB 15.1

            marxjohnson Mark Johnson
            simonpl Simon Plasger
            Votes:
            5 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:

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