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

Capability check error

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2
    • 2.2.1
    • Questions
    • Any
    • MOODLE_22_STABLE
    • MOODLE_22_STABLE
    • Hide

      Replace next function:

       public function having_cap($cap) {
              $contextswithcap = array();
              foreach ($this->allcontexts as $context) {
                  if (has_capability($cap, $context)) {
                      $contextswithcap[] = $context;
                  }
              }
              return $contextswithcap;
          }
       

      with:

       public function having_cap($cap) {
              $contextswithcap = array();
              foreach ($this->allcontexts as $context) {
                  if ($context!=NULL && has_capability($cap, $context)) {
                      $contextswithcap[] = $context;
                  }
              }
              return $contextswithcap;
          }
       

      Show
      Replace next function: public function having_cap($cap) { $contextswithcap = array(); foreach ($this->allcontexts as $context) { if (has_capability($cap, $context)) { $contextswithcap[] = $context; } } return $contextswithcap; }   with: public function having_cap($cap) { $contextswithcap = array(); foreach ($this->allcontexts as $context) { if ($context!=NULL && has_capability($cap, $context)) { $contextswithcap[] = $context; } } return $contextswithcap; }  
    • Hide

      We need to verify that this code change does not cause any regressions.

      Logged in as a teacher, create and edit some questions in the question bank, and move them between categories, and make sure there are no errors.

      Show
      We need to verify that this code change does not cause any regressions. Logged in as a teacher, create and edit some questions in the question bank, and move them between categories, and make sure there are no errors.

    Description

      After upgrade I get "Coding error detected, it must be fixed by a programmer: PHP catchable fatal error" when try to view a course.

      Attachments

        Issue Links

          Activity

            People

              timhunt Tim Hunt
              rodries rodrigo
              Sam Hemelryk Sam Hemelryk
              Sam Hemelryk Sam Hemelryk
              Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                9/Jan/12