Skip to content

Commit 6fad799

Browse files
apetitpafabpot
authored andcommitted
[Validator] Allow checkMX() to return false when $host is empty
| Q | A | | --- | --- | | Branch? | master | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | #22106 | | License | MIT | | Doc PR | n/a |
1 parent 439675a commit 6fad799

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Constraints/EmailValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ public function validate($value, Constraint $constraint)
138138
*/
139139
private function checkMX($host)
140140
{
141+
if (null === $host || '' === $host) {
142+
return false;
143+
}
144+
141145
return checkdnsrr($host, 'MX');
142146
}
143147

0 commit comments

Comments
 (0)