Issues

ZF2-337: inArray validator do nothing unless strict is set to true

Description

Unless 'strict' is set to true, the validator just pass the test no matter which data is posted.

Works


$this->add($factory->createInput(array(
    'name'       => 'activity_type',
    'required'   => true,
    'validators' => array(
        array(
            'name' => 'InArray',
            'options' => array(
                'haystack' => array('test', 0, 'A'),
                'strict'   => true,
            ),
        ),
    ),
)));

Dont works


$this->add($factory->createInput(array(
    'name'       => 'activity_type',
    'required'   => true,
    'validators' => array(
        array(
            'name' => 'InArray',
            'options' => array(
                'haystack' => array('test', 0, 'A'),
            ),
        ),
    ),
)));

Comments

What data are you using?

Simple form post

Added a check forcing to use strict mode when 0 is present in the haystack

https://github.com/zendframework/zf2/pull/1858