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

Capability check error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2.1
    • Component/s: Questions
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      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.
    • Workaround:
      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; }  
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      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

              Assignee:
              timhunt Tim Hunt
              Reporter:
              rodries rodrigo
              Integrator:
              Sam Hemelryk
              Tester:
              Sam Hemelryk
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Jan/12