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

Forms: Detect problem with PHP max_input_vars

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.6
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      1. Copy the temporary test file mdl41103.php from this issue into the root directory of your Moodle code tree. (NOTE: At time of writing it is also possible to test this issue using genuine forms such as the backup script, but I hope we will fix that later, so I don't want to put it in the test script. Anyway it's easier to use the test file.)

      2. In your browser, visit /mdl41103.php?fields=50
      3. You should see a form with 50 fields. Click the Submit button.

      EXPECTED: You should see the message 'Form submitted OK - max checkbox 50'.

      4. Now visit /mdl41103.php?fields=1000 (this assumes you have not altered the max_input_vars setting in php.ini from the default; if you have altered it, use the same value as max_input_vars is set to)

      5. Submit the form with 1000 checkboxes.

      EXPECTED: You should get a Moodle error message about incomplete form data.

      (Prior to this fix, step 5 would result in a supposedly 'correct' submission that only has 996 checkboxes.)

      Note: There is also an automated unit test as part of this code change.

      Show
      1. Copy the temporary test file mdl41103.php from this issue into the root directory of your Moodle code tree. (NOTE: At time of writing it is also possible to test this issue using genuine forms such as the backup script, but I hope we will fix that later, so I don't want to put it in the test script. Anyway it's easier to use the test file.) 2. In your browser, visit /mdl41103.php?fields=50 3. You should see a form with 50 fields. Click the Submit button. EXPECTED: You should see the message 'Form submitted OK - max checkbox 50'. 4. Now visit /mdl41103.php?fields=1000 (this assumes you have not altered the max_input_vars setting in php.ini from the default; if you have altered it, use the same value as max_input_vars is set to) 5. Submit the form with 1000 checkboxes. EXPECTED: You should get a Moodle error message about incomplete form data. (Prior to this fix, step 5 would result in a supposedly 'correct' submission that only has 996 checkboxes.) Note: There is also an automated unit test as part of this code change.
    • Affected Branches:
      MOODLE_26_STABLE
    • Pull Master Branch:
      MDL-41103-master

      Description

      In various forms it is possible that the PHP max_input_vars limit may prevent the form data from being completely processed. (This usually happens only for large sites.) Behaviour can be unpredictable because fields toward the end of the form are simply not sent.

      To detect this problem we should include a hidden-field marker at the end of the form and display an error message if this is not received.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              quen Sam Marshall
              Reporter:
              quen Sam Marshall
              Peer reviewer:
              Dan Poltawski
              Integrator:
              Marina Glancy
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: