mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-01 04:59:18 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 563d0cdde5 | |||
| c7ab280976 | |||
| f46887bc48 |
@@ -5,5 +5,5 @@ namespace Egulias\EmailValidator\Exception;
|
|||||||
class UnclosedComment extends InvalidEmail
|
class UnclosedComment extends InvalidEmail
|
||||||
{
|
{
|
||||||
const CODE = 146;
|
const CODE = 146;
|
||||||
const REASON = "No colosing comment token found";
|
const REASON = "No closing comment token found";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,10 +97,7 @@ class DNSCheckValidation implements EmailValidation
|
|||||||
*/
|
*/
|
||||||
protected function checkDns($host)
|
protected function checkDns($host)
|
||||||
{
|
{
|
||||||
$variant = INTL_IDNA_VARIANT_2003;
|
$variant = INTL_IDNA_VARIANT_UTS46;
|
||||||
if (defined('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), '.') . '.';
|
||||||
|
|
||||||
@@ -118,11 +115,12 @@ class DNSCheckValidation implements EmailValidation
|
|||||||
private function validateDnsRecords($host)
|
private function validateDnsRecords($host)
|
||||||
{
|
{
|
||||||
// Get all MX, A and AAAA DNS records for host
|
// Get all MX, A and AAAA DNS records for host
|
||||||
$dnsRecords = dns_get_record($host, DNS_MX + DNS_A + DNS_AAAA);
|
// Using @ as workaround to fix https://bugs.php.net/bug.php?id=73149
|
||||||
|
$dnsRecords = @dns_get_record($host, DNS_MX + DNS_A + DNS_AAAA);
|
||||||
|
|
||||||
|
|
||||||
// No MX, A or AAAA DNS records
|
// No MX, A or AAAA DNS records
|
||||||
if (empty($dnsRecords)) {
|
if (empty($dnsRecords) || !$dnsRecords) {
|
||||||
$this->error = new NoDNSRecord();
|
$this->error = new NoDNSRecord();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user