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

Typo in accesslib causes performance optimization to be skipped

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.7
    • Component/s: Roles / Access
    • Labels:

      Description

      There appears to be a typo in get_user_accessdata() in lib/accesslib.php, L1116-1122:

          if (!empty($USER->acces['rdef']) and empty($ACCESSLIB_PRIVATE->rolepermissions)) {
              // share rdef from USER session with rolepermissions cache in order to conserve memory
              foreach($USER->acces['rdef'] as $k=>$v) {
                  $ACCESSLIB_PRIVATE->rolepermissions[$k] =& $USER->acces['rdef'][$k];
              }
              $ACCESSLIB_PRIVATE->accessdatabyuser[$USER->id] = $USER->acces;
          }
      

      I believe it should be $USER->access, not $USER->acces (all four references in this block).

      Because of the first condition the effect of this typo is that this block of code above is never run. While not necessary for the function to work it is there to save memory so assuming that the code is otherwise correct fixing the typo should reduce memory consumption.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              simoncoggins Simon Coggins
              Reporter:
              simoncoggins Simon Coggins
              Peer reviewer:
              Petr Skoda
              Integrator:
              Dan Poltawski
              Tester:
              Dan Poltawski
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                12/May/14