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

Typo in accesslib causes performance optimization to be skipped

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.7
    • 2.6
    • Roles / Access

      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.

            simoncoggins Simon Coggins
            simoncoggins Simon Coggins
            Petr Skoda Petr Skoda
            Dan Poltawski Dan Poltawski
            Dan Poltawski Dan Poltawski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.