Skip to content

Commit 24d8121

Browse files
apetitpafabpot
authored andcommitted
Switch to empty native function to check emptiness
Switch to `empty` because depending on the PHP version, substr returns '' or false
1 parent 8321c49 commit 24d8121

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Constraints/EmailValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function validate($value, Constraint $constraint)
138138
*/
139139
private function checkMX($host)
140140
{
141-
return '' !== $host && checkdnsrr($host, 'MX');
141+
return !empty($host) && checkdnsrr($host, 'MX');
142142
}
143143

144144
/**
@@ -150,6 +150,6 @@ private function checkMX($host)
150150
*/
151151
private function checkHost($host)
152152
{
153-
return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
153+
return !empty($host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
154154
}
155155
}

0 commit comments

Comments
 (0)