10000 cast substr result to string and remove empty function use · symfony/symfony@1825d0f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1825d0f

Browse files
apetitpafabpot
apetitpa
authored andcommitted
cast substr result to string and remove empty function use
1 parent 894127b commit 1825d0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/Validator/Constraints/EmailValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function validate($value, Constraint $constraint)
9393
return;
9494
}
9595

96-
$host = substr($value, strrpos($value, '@') + 1);
96+
$host = (string) substr($value, strrpos($value, '@') + 1);
9797

9898
// Check for host DNS resource records
9999
if ($constraint->checkMX) {
@@ -138,7 +138,7 @@ public function validate($value, Constraint $constraint)
138138
*/
139139
private function checkMX($host)
140140
{
141-
return !empty($host) && checkdnsrr($host, 'MX');
141+
return '' !== $host && checkdnsrr($host, 'MX');
142142
}
143143

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

0 commit comments

Comments
 (0)
0