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

PHP warning on quiz index page

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9.7, 3.10.4
    • 3.9.6, 3.10.3, 3.11
    • Quiz
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • master-MDL-71376
    • Hide

      You need to test this using PHP 7.4 or later, and you must have developer debugging turned on.

      1. Find or create a course ...
      2. ... with a quiz.
      3. Go to the list of all quizzes in the course (.../mod/quiz/index.php?id=[courseid] - not sure how you get there using the navigation in standard Moodle themes.)

      Verify the page displays without errors.

      Show
      You need to test this using PHP 7.4 or later, and you must have developer debugging turned on. Find or create a course ... ... with a quiz. Go to the list of all quizzes in the course (.../mod/quiz/index.php?id= [courseid] - not sure how you get there using the navigation in standard Moodle themes.) Verify the page displays without errors.

      The following warning is produced when accessing the quiz index page:

      Warning: Creating default object from empty value in mod/quiz/index.php on line 129

      This warning can be seen on Moodle versions: 3.9, 3.10, 3.11 and master when running PHP 7.4.x. On PHP versions lower than 7.4, this warning is not produced.

      The offending line of code is:

      $learningtable->data[] = 'hr';
      

      $learningtable is not defined. It seems to be a typo.

       

      Steps to reproduce this condition

      1. Set your PHP version to 7.4.x.
      2. On, Moodle, ensure that Developer mode and display errors are enabled.
      3. Access a course that uses Topics format. (You should have editing rights.)
      4. Turn editing on and add the Activities block to the course page.
      5. Add a new quiz in section 1.
      6. Add a new quiz in section 2.
      7. From the Activities block, click on Quizzes to access the quiz index page: mod/quiz/index.php
      8. You should see the "Warning: Creating default object from empty value" message.

       

            rjnl Rajneel Totaram
            rjnl Rajneel Totaram
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 40 minutes
                40m

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