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

Accesslib load_capability_def uses require_once when it should be require

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8
    • Component/s: Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE

      Description

      load_capability_def() does the following:

      if (file_exists($defpath)) {
      require_once($defpath);
      $capabilities = ${$varprefix.'_capabilities'};
      }

      This code will fail if it runs more than once because the thing that's required defines a (local) variable so needs to be included each time it runs. Under ordinary circumstances, it shouldn't run more than once, so it doesn't matter. But since it's kind of poor code - and since we are, er, doing something in a local change that needs it to run more than once - I'll check in the fix to just use require.

        Attachments

          Activity

            People

            Assignee:
            quen Sam Marshall
            Reporter:
            quen Sam Marshall
            Tester:
            Nobody
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              31/Mar/07