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

Cache store add instance form validation doesn't handle errors well at all!

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.1
    • Component/s: Caching
    • Labels:
    • Testing Instructions:
      Hide

      There is no real good way to test this in core presently as its unused.
      However the following can be done:

      1. Install XCache and enable it by giving it a positive xcache.var_size value.
      2. Install the XCache plugin from here https://github.com/samhemelryk/moodle-cachestore_xcache
      3. Log in as an admin
      4. Browse to Settings > Plugins > Caching > Configuration
      5. Add an XCache instance, give it a name that is not unique, and give it the prefix test.
      6. Check you get an error about the name not being unique when you try to submit.
      Show
      There is no real good way to test this in core presently as its unused. However the following can be done: Install XCache and enable it by giving it a positive xcache.var_size value. Install the XCache plugin from here https://github.com/samhemelryk/moodle-cachestore_xcache Log in as an admin Browse to Settings > Plugins > Caching > Configuration Add an XCache instance, give it a name that is not unique, and give it the prefix test. Check you get an error about the name not being unique when you try to submit.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull Master Branch:
      wip-MDL-36939-m25

      Description

      When a cache store instances configuration is changed and the form values validated the instance callback to handle validation isn't given the current errors and then overwrites the errors array as its result.
      This means that duplicate names and such can get through validation and break a system if a cache store is being used that handles custom validation.

        Gliffy Diagrams

          Activity

          Hide
          samhemelryk Sam Hemelryk added a comment -

          Putting this straight up for integration review.

          Show
          samhemelryk Sam Hemelryk added a comment - Putting this straight up for integration review.
          Hide
          poltawski Dan Poltawski added a comment -

          Thanks Sam, i've integrated this now

          Show
          poltawski Dan Poltawski added a comment - Thanks Sam, i've integrated this now
          Hide
          dmonllao David Monllaó added a comment -

          It passes; I see the not unique warning

          Show
          dmonllao David Monllaó added a comment - It passes; I see the not unique warning
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

          Closing, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Jan/13