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

Internal record cache can be modified

    XMLWordPrintable

Details

    • MOODLE_18_STABLE, MOODLE_19_STABLE
    • 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.

      Attachments

        1. dmlib.diff
          1.0 kB
          Mark Nielsen

        Activity

          People

            nicolasconnault Nicolas Connault
            bushido Mark Nielsen
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3/Mar/08