Skip to content

Constraints\EmailValidator invalid LogicException namespace in VALIDATION_MODE_STRICT #48985

@99hops

Description

@99hops

Symfony version(s) affected

6.2

Description

Inside EmailValidator in case of !class_exists(EguliasEmailValidator::class) there is throw new LogicException() which results in:

Attempted to load class "LogicException" from namespace "Symfony\Component\Validator\Constraints". Did you forget a "use" statement for e.g. "Symfony\Component\VarExporter\Exception\LogicException", "Symfony\Component\Validator\Exception\LogicException", "Symfony\Component\Translation\Exception\LogicException", "Symfony\Component\Serializer\Exception\LogicException", "Symfony\Component\Security\Core\Exception\LogicException", "Symfony\Component\PasswordHasher\Exception\LogicException", "Symfony\Component\Mime\Exception\LogicException", "Symfony\Component\Messenger\Exception\LogicException", "Symfony\Component\DependencyInjection\Exception\LogicException", "Symfony\Component\Console\Exception\LogicException", "Symfony\Component\Cache\Exception\LogicException" or "JMS\Serializer\Exception\LogicException"?

https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/Validator/Constraints/EmailValidator.php#L77

How to reproduce

Add Constraints\Email in Email::VALIDATION_MODE_STRICT without "egulias/email-validator" Email

Possible Solution

I suggest we add use Symfony\Component\Validator\Exception\LogicException;

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions