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

Internal record cache can be modified

    Details

    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Moodle config settings:

      cachetype: internal
      rcache: true

      The test (I added this block to the top of index.php):

      // Get course, print name, change name
      $course = get_record('course', 'id', SITEID);
      notify($course->fullname); // Prints: TESTING SITE
      $course->fullname = 'newname';

      // Get course again, print name
      $course = get_record('course', 'id', SITEID);
      notify($course->fullname); // Prints: newname
      die;

      From the above, the first time we get the course, we modify it, which in turn modifies the object in the cache. The cache should return a clone of the object stored in the cache to prevent this from happening.

      This doesn't seem to be a problem with the other caching types, but I wasn't able to test eaccelerator.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Mar/08