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

Course asset deletion causes PHP catchable fatal error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.3.4
    • Course
    • None
    • MOODLE_23_STABLE

      Teacher is deleting items in the course. Seems to be random, but at some point, in some of our courses, they get a message "Coding error detected, it must be fixed by a programmer: PHP catchable fatal error"

      I found that deleting sectioncache from the course in the database fixes the problem, but I also dug in a bit deeper.

      With debug on:
      Debug info: Argument 2 passed to has_capability() must be an instance of context, boolean given, called in modinfolib.php on line 1097 and defined
      Error code: codingerror

      In debugging the module, modcontext is returning empty causing has_capability to error out.

      I added the following code to modinfolib.php update_user_visible() as a work around, but, I believe the issus is occurring at the time of deletion and not display.

      if ($modcontext != "") {
      if ((!$this->visible or !$this->available) and
      !has_capability('moodle/course:viewhiddenactivities', $modcontext, $userid))

      { $this->uservisible = false; }

      } else

      { $this->uservisible = false; }

      Now the course will open without my intervention.

      I have not been able to 100% pin down a testing method, but it has happend repeatedly this past week (our semester just started), so it might be the upgrade version, it might have been there all along.

      I am running the weekly build Moodle 2.3.4+ (Build: 20130125)

        1. bug.png
          15 kB
          Russell Smith

            poltawski Dan Poltawski
            jayhuber Jay Huber
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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