Compare commits

...

3 Commits

Author SHA1 Message Date
kishor 563d0cdde5 Issue-257: Fix PHP 7.3 compatibility issues. (#264) 2020-09-19 16:37:56 +02:00
zloKOMAtic c7ab280976 Update UnclosedComment.php (#263) 2020-09-19 16:37:41 +02:00
Eduardo Gulias Davis f46887bc48 Fix #260 with workaround (#261) 2020-09-06 15:44:32 +02:00
2 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -5,5 +5,5 @@ namespace Egulias\EmailValidator\Exception;
class UnclosedComment extends InvalidEmail
{
const CODE = 146;
const REASON = "No colosing comment token found";
const REASON = "No closing comment token found";
}
+4 -6
View File
@@ -97,10 +97,7 @@ class DNSCheckValidation implements EmailValidation
*/
protected function checkDns($host)
{
$variant = INTL_IDNA_VARIANT_2003;
if (defined('INTL_IDNA_VARIANT_UTS46')) {
$variant = INTL_IDNA_VARIANT_UTS46;
}
$variant = INTL_IDNA_VARIANT_UTS46;
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';
@@ -118,11 +115,12 @@ class DNSCheckValidation implements EmailValidation
private function validateDnsRecords($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
if (empty($dnsRecords)) {
if (empty($dnsRecords) || !$dnsRecords) {
$this->error = new NoDNSRecord();
return false;
}