Skip to content

[Validator] Emtpy string passes Length min = 1 constraint validation, though it shoud not (or docs are misleading) #11943

@drscre

Description

@drscre

From the documentation for Length constraint (http://symfony.com/doc/current/reference/constraints/Length.html)

Validates that a given string length is between some minimum and maximum value.

For min option:

Validation will fail if the given value's length is less than this min value.

Nothing special is said about empty strings. It seems reasonable to assume that if you validate an empty string against Length constraint with min = 1 it should fail.

But in reality, emty string passes validation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions