Skip to content

Email assert passes empty string #10357

Closed
@yuri-karkh

Description

@yuri-karkh
    /**
     * @var string
     * @ORM\Column(name="email", type="string", length=100, unique=true)
     * @Assert\Email(
	 *     message="Email is not valid",
	 *     mode="html5"
	 * )
     */
    private $email;

passing empty string as an email passed validation. var_dump of the $validator->validate( $object ); is below.

object(Symfony\Component\Validator\ConstraintViolationList)#3636 (1) {
 ["violations":"Symfony\Component\Validator\ConstraintViolationList":private]=>
 array(0) {
 }
}

Also found similar issue here:
#4244

I can confirm that if use together with NotBlank() constraint Email() constraint works as expected. So not very obvious behaviour of assertion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ValidatorhasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions