Skip to content

Deprecate and remove SPACE case for NotEmpty validator #229

@Xerkus

Description

@Xerkus

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions