zendframework/zend-validator

Between validator returns true when value is null

Closed this issue · 1 comments

MitoG commented

When the passed value is null the Between validator will return true instead of false.

$value = null;

$validator = new Between(['min' => 0, 'max' => 10, 'inclusive' => true]);
$validator->isValid($value); // returns true

PHP type juggling works as expected.
If null is not an allowed input, you should use chained NotEmpty validator