Switch to `empty` native function to check emptiness

Switch to `empty` because depending on the PHP version, substr returns '' or false
This commit is contained in:
apetitpa 2017-03-24 17:16:55 +01:00 committed by Fabien Potencier
parent f390f29173
commit 6f24b05467
1 changed files with 2 additions and 2 deletions

View File

@ -138,7 +138,7 @@ class EmailValidator extends ConstraintValidator
*/
private function checkMX($host)
{
return '' !== $host && checkdnsrr($host, 'MX');
return !empty($host) && checkdnsrr($host, 'MX');
}
/**
@ -150,6 +150,6 @@ class EmailValidator extends ConstraintValidator
*/
private function checkHost($host)
{
return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
return !empty($host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
}
}