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.)
- has a non-specific relationship to
-
MDL-47665 workaround_max_input_vars() not working well with array query params
- Closed
- has been marked as being related by
-
MDL-71390 PHP8 does not like our max_input_vars workaround. Proposed solution - set minimum requirement for max_input_vars
- Closed
- will be (partly) resolved by
-
MDL-52226 max_input_vars still causes problems with advanced checkboxes
- Closed