Skip to content

NotBlank should not fail when false is given #9961

@wouterj

Description

@wouterj

The following code resulted in an error:

class Registration
{
    /**
     * @Assert\Type("bool")
     * @Assert\NotBlank
     */
    public $acceptedTerms;
}

$foo = new Registration();
$foo->acceptedTerms = false;
$validator->validate($foo);

For some reason, NotBlank is developed to see false as blank. I can't see the reason behind this and it would fail in cases like this.

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