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

PHP warning on quiz index page

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9.6, 3.10.3, 3.11
    • Fix Version/s: 3.9.7, 3.10.4
    • Component/s: Quiz
    • Labels:

      Description

      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.

       

        Attachments

          Activity

            People

            Assignee:
            rjnl Rajneel Totaram
            Reporter:
            rjnl Rajneel Totaram
            Peer reviewer:
            Tim Hunt Tim Hunt
            Integrator:
            Andrew Lyons Andrew Lyons
            Tester:
            Anna Carissa Sadia Anna Carissa Sadia
            Participants:
            Component watchers:
            Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/May/21

                Time Tracking

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