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

        Activity

          People

            nicolasconnault Nicolas Connault
            bushido Mark Nielsen
            Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona), David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              3/Mar/08