Deprecate and remove SPACE case for NotEmpty validator
Xerkus opened this issue · 1 comments
NotEmpty validator considers string ' '
empty by default due to space
case. It is a surprising behavior that apparently got inherited from ZF1 over 12 years ago.
laminas-validator/src/NotEmpty.php
Lines 64 to 71 in fac99d7
In case of laminas-inputfilter it would be a filter responsibility to remove spaces or anything else like line feed before validation.
I would say this condition is useful only for laminas-form and only for a sloppy input filter definitions. This case should really be handled by the trim filter.
I kind of agree, but validator does not depend on filter
or input-filter
- I don't think it's unreasonable to consider
as a validation failure by default. You could make the argument that input should be filtered by the ToNull
filter which would negate the need for self::STRING
and self::EMPTY_ARRAY
too probably.
If you have strong feelings here, v3 is getting pretty close…