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

[InputFilter][Hotfix] Missing check for allowEmpty() #4567

Closed
wants to merge 4 commits into from

Conversation

davidwindell
Copy link
Contributor

The InputFilter was allowing empty strings to pass through when allowEmpty was set to true since the refactor.

Ping @weierophinney

@weierophinney
Copy link
Member

@davidwindell This creates a regression, it appears: https://travis-ci.org/zendframework/zf2/jobs/7637942#L498 -- 5 new failures/errors.

@@ -236,6 +236,7 @@ protected function validateInputs(array $inputs)
&& '' === $this->data[$name]
&& $input instanceof InputInterface
&& !$input->isRequired()
&& $input->allowEmpty()
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to be OR'd with the previous statement.

@weierophinney
Copy link
Member

@davidwindell I've voiced some concerns above, and for the time being have removed the milestone. I'll set a new milestone once you're able to provide feedback and/or address the concerns.

Thanks in advance!

@davidwindell
Copy link
Contributor Author

@weierophinney looking into this, I believe the correct way to solve is, as you say, to set "allow empty" flag to the reverse of "required" by default. In fact, the factory was already doing this if the user didn't explicitly specify allow_empty.

I've updated the factory too to ensure that regardless of the order of the specification, the allow_empty flag specified by the user (if any) is always respected..

I think this should be good for merge now.

weierophinney added a commit that referenced this pull request Jun 28, 2013
[InputFilter][Hotfix] Missing check for allowEmpty()
weierophinney added a commit that referenced this pull request Jun 28, 2013
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
…/patch-11

[InputFilter][Hotfix] Missing check for allowEmpty()
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
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.

None yet

3 participants