DNS record check now passes if email address has no top-level domain (#355)

This commit is contained in:
KergeKacsa
2023-01-14 15:17:03 +01:00
committed by GitHub
parent db4c31490b
commit 3a85486b70
2 changed files with 15 additions and 3 deletions
+13 -2
View File
@@ -123,9 +123,20 @@ class DNSCheckValidation implements EmailValidation
{
$variant = INTL_IDNA_VARIANT_UTS46;
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.');
return $this->validateDnsRecords($host);
$hostParts = explode('.', $host);
$host = array_pop($hostParts);
while (count($hostParts) > 0) {
$host = array_pop($hostParts) . '.' . $host;
if ($this->validateDnsRecords($host)) {
return true;
}
}
return false;
}