|
@@ -17,7 +17,6 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
|
|
|
|
|
class EmailValidator extends ConstraintValidator
|
|
|
{
|
|
|
- const PATTERN = '/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i';
|
|
|
|
|
|
public function isValid($value, Constraint $constraint)
|
|
|
{
|
|
@@ -31,7 +30,7 @@ class EmailValidator extends ConstraintValidator
|
|
|
|
|
|
$value = (string)$value;
|
|
|
|
|
|
- if (!preg_match(self::PATTERN, $value)) {
|
|
|
+ if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
|
|
|
$this->setMessage($constraint->message, array('{{ value }}' => $value));
|
|
|
|
|
|
return false;
|