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

Wrong context check in advanced recent activity

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Found while debugging to MDL-12555, (the cause of both these bugs seems to be a mixup in what 'instance' is when in the quiz_print_recent_mod_activity(). At the moment its seems to be the id of the quiz in question.

      Error: could not insert new context level "70", instance "162".
      line 2255 of lib/accesslib.php: call to debugging()
      line 2530 of lib/accesslib.php: call to create_context()
      line 596 of mod/quiz/lib.php: call to get_context_instance()
      line 286 of course/recent.php: call to quiz_print_recent_mod_activity()
      Incorrect context specified
      line 326 of lib/accesslib.php: call to debugging()
      line 596 of mod/quiz/lib.php: call to has_capability()
      line 286 of course/recent.php: call to quiz_print_recent_mod_activity()

      To Reproduce:
      1) Go a course with quiz responses in, view recent activity
      2) View advanced recent activity and sort by course order
      3)Should get invalid debugging as adbove

      When the above context is being requested we are passing quizid to get_context_instance rather than the course module id:

      Releated to this, the issue mentioned in MDL-12555 is caused by this line on 591, mixing up the cmid and quiz id:
      view.php?id=" . $activity->instance

      That can be reproduced by changing the advanced sort order to a date order.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              poltawski Dan Poltawski
              Tester:
              Séverin Terrier
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Mar/08