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

Course asset deletion causes PHP catchable fatal error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.3.4
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
      None
    • Affected Branches:
      MOODLE_23_STABLE

      Description

      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)

        Attachments

        1. bug.png
          15 kB
          Russell Smith

          Issue Links

            Activity

              People

              Assignee:
              poltawski Dan Poltawski
              Reporter:
              jayhuber Jay Huber
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: