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

Typo in accesslib causes performance optimization to be skipped (backport of MDL-43049)

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1/ Check all unit tests (particular the accesslib tests) pass.
      2/ Verify cron processing works - mod_forum subscriptions is a nice example
      3/ Run behat tests

      Show
      1/ Check all unit tests (particular the accesslib tests) pass. 2/ Verify cron processing works - mod_forum subscriptions is a nice example 3/ Run behat tests
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull from Repository:

      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:
              mr-russ Russell Smith
              Reporter:
              poltawski Dan Poltawski
              Integrator:
              Dan Poltawski
              Tester:
              Rajesh Taneja
              Participants:
              Component watchers:
              Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Mar/14