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

Forms: Detect problem with PHP max_input_vars

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.6
    • Forms Library
    • MOODLE_26_STABLE
    • MDL-41103-master
    • 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.

      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.

            quen Sam Marshall
            quen Sam Marshall
            Dan Poltawski Dan Poltawski
            Marina Glancy Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.