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

max_input_vars work-around is not always working

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • 2.6.5, 2.7.2, 3.9.3
    • None
    • Libraries
    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_39_STABLE

    Description

      There is a problem with what was done in MDL-41819 / https://github.com/moodle/moodle/commit/a377754770c60b8eb5783907c6c201a0ef9d28eb#diff-377c7a98a303389798f7be101fb59f56R958

      That previous issue gives a good summary of the history so far, and I have linked to the part of the previous commit where the issue is.

      The problem I am seeing is with restoring a large course, on a site where max_input_vars is 1000.

      It seems that the restore forms have two <input type="hidden" name="contextid" value="2">, so that when $_POST is parsed, after parsing the first 1000 variables, $_POST only contains 999 values.

      So, when you get to https://github.com/moodle/moodle/commit/a377754770c60b8eb5783907c6c201a0ef9d28eb#diff-377c7a98a303389798f7be101fb59f56R974, the work-around is not applied.

      Now you might say that duplicated id is just a bug in the backup form (and you would probably be right). However, some formlib fields (e.g. advanced-checkbox) work that way by design. So, this will affect other big forms.

      Can anyone think of a good solution?

      (Right now I just neet to make this restore work on my test server, so I will hack that line to say if (count($_POST, COUNT_RECURSIVE) < $max * 0.9) {, but I don't think that is a good solution to this bug.)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              timhunt Tim Hunt
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: