ZF2 EmailAdress Validator accepting ç

0
Hello, I'm doing email validation on a ZF2 system using Zend \ Validator \ EmailAdress and passing an email as teste@çço.com is considered valid, when in fact this is not valid.

Does anyone know how to proceed?

Piece of code:

$emailValidate = new \Zend\Validator\EmailAddress;

if (!$emailValidate->isValid($dados->email)) {
    throw new ValidationException('E-mail inválido', 4);
}
    
asked by anonymous 03.04.2018 / 22:16

1 answer

0

By default it accepts accented characters in the IDN domain as it appears in documentation .

To disable the setValidateIdn() pass the value false .

Something like:

$validator->getHostnameValidator()->setValidateIdn(false);
    
03.04.2018 / 22:29