Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[Hotfix] FilePostRedirectGet plugin and form collections #5641

Conversation

stefanotorresi
Copy link
Contributor

This PR fixes a problem with the fileprg plugin when using form collections with either allow_add or allow_remove set to true.

FilePostRedirectGet invoked Form::getInputFilter() before Form::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.

dpommeranz and others added 2 commits January 14, 2014 19:42
Conflicts:
	library/Zend/Mvc/Controller/Plugin/FilePostRedirectGet.php
@2DivisionsByZero
Copy link
Contributor

Multiple collection elements are still not working. See tests at stefanotorresi#2

@weierophinney weierophinney added this to the 2.2.6 milestone Mar 3, 2014
@weierophinney weierophinney self-assigned this Mar 3, 2014
weierophinney added a commit that referenced this pull request Mar 3, 2014
…inputfiltering

[Hotfix] FilePostRedirectGet plugin and form collections

Conflicts:
	library/Zend/Mvc/Controller/Plugin/FilePostRedirectGet.php
	tests/ZendTest/Mvc/Controller/Plugin/FilePostRedirectGetTest.php
weierophinney added a commit that referenced this pull request Mar 3, 2014
- EOF ending
weierophinney added a commit that referenced this pull request Mar 3, 2014
Forward port #5641

Conflicts:
	library/Zend/Stdlib/ArrayUtils.php
@stefanotorresi stefanotorresi deleted the fix/file-prg-collection-inputfiltering branch March 6, 2014 11:31
weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
…si/fix/file-prg-collection-inputfiltering

[Hotfix] FilePostRedirectGet plugin and form collections

Conflicts:
	library/Zend/Mvc/Controller/Plugin/FilePostRedirectGet.php
	tests/ZendTest/Mvc/Controller/Plugin/FilePostRedirectGetTest.php
weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
Forward port zendframework/zendframework#5641

Conflicts:
	library/Zend/Stdlib/ArrayUtils.php
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fileprg and array merge recursive
4 participants