mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-11 18:47:02 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a85486b70 |
@@ -123,9 +123,20 @@ class DNSCheckValidation implements EmailValidation
|
|||||||
{
|
{
|
||||||
$variant = INTL_IDNA_VARIANT_UTS46;
|
$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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class DNSCheckValidationTest extends TestCase
|
|||||||
return [
|
return [
|
||||||
// dot-atom
|
// dot-atom
|
||||||
['Abc@ietf.org'],
|
['Abc@ietf.org'],
|
||||||
|
['Abc@fake.ietf.org'],
|
||||||
['ABC@ietf.org'],
|
['ABC@ietf.org'],
|
||||||
['Abc.123@ietf.org'],
|
['Abc.123@ietf.org'],
|
||||||
['user+mailbox/department=shipping@ietf.org'],
|
['user+mailbox/department=shipping@ietf.org'],
|
||||||
@@ -149,4 +150,4 @@ class DNSCheckValidationTest extends TestCase
|
|||||||
$validation->isValid('example@invalid.example.com', new EmailLexer());
|
$validation->isValid('example@invalid.example.com', new EmailLexer());
|
||||||
$this->assertEquals($expectedError, $validation->getError());
|
$this->assertEquals($expectedError, $validation->getError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user