10000 [Validator] check for empty host when calling checkdnsrr() by apetitpa · Pull Request #22109 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator] check for empty host when calling checkdnsrr() #22109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cast substr result to string and remove empty function use
  • Loading branch information
apetitpa committed Mar 27, 2017
commit c9b4613f2f991f72dced573d2f7aeb79a009cd48
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function validate($value, Constraint $constraint)
return;
}

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

// Check for host DNS resource records
if ($constraint->checkMX) {
Expand Down Expand Up @@ -118,7 +118,7 @@ public function validate($value, Constraint $constraint)
*/
private function checkMX($host)
{
return !empty($host) && checkdnsrr($host, 'MX');
return '' !== $host && checkdnsrr($host, 'MX');
}

/**
Expand All @@ -130,6 +130,6 @@ private function checkMX($host)
*/
private function checkHost($host)
{
return !empty($host) && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
return '' !== $host && ($this->checkMX($host) || (checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA')));
}
}
0