[InputFilter][Hotfix] Missing check for allowEmpty() #4567
Conversation
@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() |
There was a problem hiding this comment.
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.
@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! |
@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 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. |
[InputFilter][Hotfix] Missing check for allowEmpty()
…/patch-11 [InputFilter][Hotfix] Missing check for allowEmpty()
The InputFilter was allowing empty strings to pass through when allowEmpty was set to true since the refactor.
Ping @weierophinney