Thanks to visit codestin.com
Credit goes to github.com

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

Fix BC break in 2.1.5dev - Revert to previous isRequired behavior for file upload inputs#4171

Closed
cgmartin wants to merge 2 commits into
zendframework:masterfrom
cgmartin:fix/file-prg-base-input-filter
Closed

Fix BC break in 2.1.5dev - Revert to previous isRequired behavior for file upload inputs#4171
cgmartin wants to merge 2 commits into
zendframework:masterfrom
cgmartin:fix/file-prg-base-input-filter

Conversation

@cgmartin
Copy link
Copy Markdown
Contributor

@cgmartin cgmartin commented Apr 3, 2013

#3983 causes BC breaks for FilePostRedirectGet Plugin, and in existing projects using File Inputs with changed isRequired settings.

To reproduce, install https://github.com/cgmartin/ZF2FileUploadExamples and test the following examples:

  • "Single File Upload with partial validation"
  • "Post-Redirect-Get Plugin Example"
  • "FilePRG Plugin Example with nested Fieldset"

With ZF2.1.4, the examples work correctly.
With ZF2.1.5dev, the examples fail.

Reported via email by @leup (Thanks!)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preserved what seemed to be the intent of #3983, but @ossinkine please look this over to make sure it's correct.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the truth.
But the expression strlen($this->data[$name]) === 0 is unnecessary, because the expression is checked before.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch - I will remove that expression.

@mwillbanks
Copy link
Copy Markdown
Contributor

@ossinkine could you please comment and verify it matches original intent?

@cgmartin
Copy link
Copy Markdown
Contributor Author

cgmartin commented Apr 6, 2013

Added update to remove unnecessary test from @ossinkine 's feedback. Should be good to go.

@ghost ghost assigned weierophinney Apr 12, 2013
weierophinney added a commit that referenced this pull request Apr 12, 2013
Fix BC break in 2.1.5dev - Revert to previous isRequired behavior for file upload inputs
weierophinney added a commit that referenced this pull request Apr 12, 2013
Forward port #4171

Conflicts:
	library/Zend/InputFilter/BaseInputFilter.php
@weierophinney
Copy link
Copy Markdown
Member

Interestingly, this was already correct on develop -- due to a huge rewrite I did to the logic a few weeks ago to make it more readable and ensure the test cases were properly represented. :)

@cgmartin
Copy link
Copy Markdown
Contributor Author

@weierophinney
Copy link
Copy Markdown
Member

@cgmartin There was a conflict in behavior between two PRs, and the only way I could sort it out was to do that. :)

@ossinkine
Copy link
Copy Markdown
Contributor

@weierophinney Can you explain why do you need such validation in BaseInputFilter? Why not do the necessary checks directly in the Input?

weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
…/file-prg-base-input-filter

Fix BC break in 2.1.5dev - Revert to previous isRequired behavior for file upload inputs
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
Forward port zendframework/zendframework#4171

Conflicts:
	library/Zend/InputFilter/BaseInputFilter.php
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants