Skip to content

Commit

Permalink
INTL_IDNA_VARIANT_UTS46 is not supported on all systems (#173)
Browse files Browse the repository at this point in the history
* INTL_IDNA_VARIANT_UTS46 is not supported on all systems

Fall back to INTL_IDNA_VARIANT_2003 if INTL_IDNA_VARIANT_UTS46 is not found.

* Fix syntax error

* Update DNSCheckValidation.php
  • Loading branch information
tomsommer authored and egulias committed Aug 16, 2018
1 parent 1354440 commit 54859fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion EmailValidator/Validation/DNSCheckValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public function getWarnings()

protected function checkDNS($host)
{
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46), '.') . '.';
$variant = INTL_IDNA_VARIANT_2003;
if ( defined('INTL_IDNA_VARIANT_UTS46') ) {
$variant = INTL_IDNA_VARIANT_UTS46;
}
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';

$Aresult = true;
$MXresult = checkdnsrr($host, 'MX');
Expand Down

0 comments on commit 54859fa

Please sign in to comment.