This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
[Hotfix] FilePostRedirectGet plugin and form collections #5641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a problem with the
fileprg
plugin when using form collections with eitherallow_add
orallow_remove
set to true.FilePostRedirectGet
invokedForm::getInputFilter()
beforeForm::setData()
, so any filter provided by collection elements did not run at all for dinamically added/removed ones, since the number of elements/filters may vary on the basis of the input data.Edit:
I also added some more code to fix another problem that occurs in the plugin, indicated in #5381.
When a collection target element is a fieldset with both a file and normal input, the merge done by
array_merge_recursive
(used by FilePRG) leads to unpredictable behaviour due to colliding numeric keys in both$_POST
and$_FILES
.#5244 (which in turn fixes #4974) adds the capability to preserve numeric keys in
ArrayUtils::merge()
#5381 was supposed to test the new behaviour but it was somehow borked, so i started from @2DivisionsByZero work to provide a comprehensive PR.