-
-
Notifications
You must be signed in to change notification settings - Fork 61
Deprecate and remove SPACE case for NotEmpty validator #229
Copy link
Copy link
Open
Labels
Description
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
| protected $defaultType = [ | |
| self::OBJECT, | |
| self::SPACE, | |
| self::NULL, | |
| self::EMPTY_ARRAY, | |
| self::STRING, | |
| self::BOOLEAN, | |
| ]; |
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.
Reactions are currently unavailable