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

Regression in calendar/lib.php breaking on user events

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1
    • Fix Version/s: 2.0.4
    • Component/s: Calendar
    • Labels:

      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!

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Raising to blocker, assigning to Rossie and setting versions (2.0 and 2.1)

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Raising to blocker, assigning to Rossie and setting versions (2.0 and 2.1)
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Hi Eloy,

            Fixed the issue, get_coursemodule_from_id() only occur on line 1890 in calendar/lib.php.

            Will assign Aparup as peer review.

            Show
            rwijaya Rossiani Wijaya added a comment - Hi Eloy, Fixed the issue, get_coursemodule_from_id() only occur on line 1890 in calendar/lib.php. Will assign Aparup as peer review.
            Hide
            nebgor Aparup Banerjee added a comment -

            this looks great and works fine! thanks!

            (the only call to that function from within calendar/* it seems!)

            Show
            nebgor Aparup Banerjee added a comment - this looks great and works fine! thanks! (the only call to that function from within calendar/* it seems!)
            Hide
            rwijaya Rossiani Wijaya added a comment -

            Thanks Apu for reviewing.
            (Yes, the function is used within calendar_event)

            Submitting this for integration.

            Show
            rwijaya Rossiani Wijaya added a comment - Thanks Apu for reviewing. (Yes, the function is used within calendar_event) Submitting this for integration.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
            Hide
            aborrow Anthony Borrow added a comment -

            I'll give this a test. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - I'll give this a test. Peace - Anthony
            Hide
            aborrow Anthony Borrow added a comment -

            I had difficulty reproducing but the fix works. Peace - Anthony

            Show
            aborrow Anthony Borrow added a comment - I had difficulty reproducing but the fix works. Peace - Anthony
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            All git & cvs servers have been updated with these cool changes, so closing, many thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - All git & cvs servers have been updated with these cool changes, so closing, many thanks!

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  1/Aug/11