[Hotfix] FilePostRedirectGet plugin and form collections #5641

Closed
wants to merge 3 commits into
from

4 participants

@stefanotorresi

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 some commits Oct 8, 2013
@2DivisionsByZero

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 weierophinney added a commit that referenced this pull request Mar 3, 2014
@weierophinney weierophinney [#5641] CS fixes
- EOF ending
8a0fdf5
@weierophinney weierophinney added a commit that closed this pull request Mar 3, 2014
@weierophinney weierophinney Merge branch 'hotfix/5641'
Close #5641
2c308a2
@weierophinney weierophinney added a commit that referenced this pull request Mar 3, 2014
@weierophinney weierophinney Merge branch 'hotfix/5641' into develop
Forward port #5641

Conflicts:
	library/Zend/Stdlib/ArrayUtils.php
41494eb
@stefanotorresi stefanotorresi deleted the stefanotorresi:fix/file-prg-collection-inputfiltering branch Mar 6, 2014
@weierophinney weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge pull request zendframework/zendframework#5641 from stefanotorre…
…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
baf4da3
@weierophinney weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/5641' bc15a3d
@weierophinney weierophinney added a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/5641' into develop
Forward port zendframework/zendframework#5641

Conflicts:
	library/Zend/Stdlib/ArrayUtils.php
ae09c82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment