Zend\Validator\Explode does not handle NULL #2726

Closed
pdobrigkeit opened this Issue Oct 10, 2012 · 1 comment

Comments

Projects
None yet
3 participants
@pdobrigkeit
Contributor

pdobrigkeit commented Oct 10, 2012

I have a Zend\Form\Input\Select which is configured with a Null Filter and the default Validators (which seem to have changed recently, adding by default the Explode Validator)

Now if I submit an empty value (empty array or missing value altogether) the filter correctly translates this to a NULL, which in turn is put into the explode validator, that now fails.

What should be the desired behaviour here?
a) Should the Explode Validator be able to handle NULL values and skip validation.
b) Should the Explode Validator be configurable to accept NULL, but how would the Select Element have to change for this?
c) Is this just a configuration problem that should be avoided (if yes, than how?)

@cgmartin

This comment has been minimized.

Show comment
Hide comment
@cgmartin

cgmartin Jan 23, 2013

Contributor

@pdobrigkeit my vote would be option A, but without skipping validation. I think the Explode validator should get out of the way (in terms of type checking) and just proxy to it's bound validators (See referenced PR #3527).

This would allow for Select and MultiCheckbox input filters to pass the filtered NULL values through the Explode validator to the InArray validator. The user would just need to ensure that NULL is a value in the InArray haystack.

Contributor

cgmartin commented Jan 23, 2013

@pdobrigkeit my vote would be option A, but without skipping validation. I think the Explode validator should get out of the way (in terms of type checking) and just proxy to it's bound validators (See referenced PR #3527).

This would allow for Select and MultiCheckbox input filters to pass the filtered NULL values through the Explode validator to the InArray validator. The user would just need to ensure that NULL is a value in the InArray haystack.

weierophinney added a commit to zendframework/zend-validator that referenced this issue May 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment