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

Subtle bug in (un)set_user_preferences

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.1.5, 3.2.2
    • 3.1.6, 3.2.3
    • Libraries
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • Hide

      The main test here is that there are no regressions. Hopefully we can rely on the full automated test run to verify that.

      Note that I added two new unit tests, which failed before my change in moodlelib.php and which pass afterwards.

      I cannot think of any manual testing that would be useful here.

      Show
      The main test here is that there are no regressions. Hopefully we can rely on the full automated test run to verify that. Note that I added two new unit tests, which failed before my change in moodlelib.php and which pass afterwards. I cannot think of any manual testing that would be useful here.

    Description

      With (un)set_user_preference, you can either pass a $user object, or a $userid, to say which user's preference to set. (If not passed, it defaults to $USER).

      Once the preference is set (or unset), it updates the cache in $user->preference cache.

      The case that is missed is that if you pass $USER->id to the function as an integer, then it dose not updated the cache in $USER. I think it should, and it took me a while to debug. Therefore, I am going to make a patch.

      Attachments

        Activity

          People

            timhunt Tim Hunt
            timhunt Tim Hunt
            Eric Merrill Eric Merrill
            Dan Poltawski Dan Poltawski
            Simey Lameze Simey Lameze
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8/May/17