zendframework/zend-validator

NotEmpty __construct creates bitmap incorrectly

Closed this issue · 0 comments

When constructing a NotEmpty validator with an array of types, the constructor adds the bitmaps instead of bit-oring them like calculateTypeValue. It's only an issue if overlapping types such as 'php' and 'boolean' are specified, but I imagine this would be a pain to debug if anyone ever runs into it.

As shown in the documentation:

$validator = new Zend\Validator\NotEmpty(array(
    'boolean',
    'php'
));

Using the constants doesn't even work, it's ignored:

$validator = new Zend\Validator\NotEmpty(array(
    Zend\Validator\NotEmpty::BOOLEAN,
    Zend\Validator\NotEmpty::PHP
));