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

Large forms are truncated by max_input_vars

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.6, 2.5.2, 2.6
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      BEFORE TESTING:

      0a. If you don't already have one, create a SIZE_S and a SIZE_L course using the admin tool from MDL-38197.
      For 24 and 25 - you can use the attached backup file and adjust the test instructions accordingly (wing it!).

      The SIZE_L course has 1,000 activities, which is enough to demonstrate this problem. The SIZE_S course fits comfortably within the default max_input_vars limit.

      TESTING:

      1. Go to the SIZE_L course and choose Backup.
      2. Click Next.
      3. The next screen contains over 2,000 checkboxes. Scroll down to the end of the page (around topic 500).
      4. Make a note of the last three page numbers as A, B, and C. For example, A = Page 492, B = Page 9, C = Page 606.
      5. For page B, turn off user data (right checkbox).
      6. For page A, turn off the entire activity (left checkbox).
      7. Click Next.
      7b. Scroll down to the bottom of the review screen.

      EXPECTED: All activities and topics should show a green tickbox against the content and for user data, except for page B which should show an X next to user data, and page A which should show an X next to both the activity and user data.

      (At this point we do NOT continue with the backup; it is expected that the backup may NOT complete unless MDL-38190 and MDL-41146 have been applied. Test step numbers 8 to 11 are not used. We will do a full backup/restore of the smaller course instead, which follows.)

      12. Go to the SIZE_S course and choose Backup.
      13. Click Next, then Next again.
      14. Continue through the backup process until it completes.
      15. Restore the backup as a new course and continue through process.
      16. Verify that course restore completes without error.

      Show
      BEFORE TESTING: 0a. If you don't already have one, create a SIZE_S and a SIZE_L course using the admin tool from MDL-38197 . For 24 and 25 - you can use the attached backup file and adjust the test instructions accordingly (wing it!). The SIZE_L course has 1,000 activities, which is enough to demonstrate this problem. The SIZE_S course fits comfortably within the default max_input_vars limit. TESTING: 1. Go to the SIZE_L course and choose Backup. 2. Click Next. 3. The next screen contains over 2,000 checkboxes. Scroll down to the end of the page (around topic 500). 4. Make a note of the last three page numbers as A, B, and C. For example, A = Page 492, B = Page 9, C = Page 606. 5. For page B, turn off user data (right checkbox). 6. For page A, turn off the entire activity (left checkbox). 7. Click Next. 7b. Scroll down to the bottom of the review screen. EXPECTED: All activities and topics should show a green tickbox against the content and for user data, except for page B which should show an X next to user data, and page A which should show an X next to both the activity and user data. (At this point we do NOT continue with the backup; it is expected that the backup may NOT complete unless MDL-38190 and MDL-41146 have been applied. Test step numbers 8 to 11 are not used. We will do a full backup/restore of the smaller course instead, which follows.) 12. Go to the SIZE_S course and choose Backup. 13. Click Next, then Next again. 14. Continue through the backup process until it completes. 15. Restore the backup as a new course and continue through process. 16. Verify that course restore completes without error.
    • Affected Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41451_master

      Description

      Large forms (Grader report, backup/restore, quizzes, etc.) are truncated by PHP 5.3.9 and above. Some forms have been adjusted to work around the limit in PHP 5.3.9, as it was applied only to each nesting level of an array - but PHP 5.4 applies max_input_vars as a hard limit on the number of fields it will process.

      The limit can be bypassed by parsing the POST body (php://input) in chunks using parse_str() (chunks necessitated by parse_str's adherence to max_input_vars). This does not work for forms submitted using the "multipart/form-data" enctype, but the main culprits don't use it anyway as uploads should all be done using file manager or file picker fields rather than done inline with regular HTML file input fields.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    11/Nov/13