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

Regression in calendar/lib.php breaking on user events

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0.3, 2.1
    • 2.0.4
    • Calendar

    Description

      While reviewing MDL-27490 it has been found one regression introduced by MDL-26516.

      It affects master and 20_STABLE. To reproduce:

      edit one quiz with (user) overrides enabled and press "save and display", it causes:

      Debug info: SELECT md.name
      FROM {modules} md
      JOIN {course_modules} cm ON cm.module = md.id
      WHERE cm.id = :cmid
      [array (
      'cmid' => '43',
      )]
      Stack trace:
      line 1282 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1354 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1340 of /lib/datalib.php: call to moodle_database->get_field_sql()
      line 1890 of /calendar/lib.php: call to get_coursemodule_from_id()
      line 1815 of /calendar/lib.php: call to calendar_event->calculate_context()
      line 2382 of /calendar/lib.php: call to calendar_event->__construct()
      line 1153 of /mod/quiz/lib.php: call to calendar_event::create()
      line 1040 of /mod/quiz/lib.php: call to quiz_update_events()
      line 113 of /mod/quiz/lib.php: call to quiz_after_add_or_update()
      line 328 of /course/modedit.php: call to quiz_update_instance()

      After tracing the problem down, it seems that there is one incorrect get_coursemodule_from_id() call in calendar/lib.php (line 1890, master). It should be get_coursemodule_from_instance() instead.

      Plz, fix it in both branches and check there are not more uses of that along the whole calendar/lib.php

      Thanks!

      Attachments

        Issue Links

          Activity

            People

              rwijaya Rossiani Wijaya
              stronk7 Eloy Lafuente (stronk7)
              Aparup Banerjee Aparup Banerjee
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Anthony Borrow Anthony Borrow
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                1/Aug/11