diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bd298936..9362e898b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. -## 2.10.1 - TBD +## 2.10.1 - 2017-08-22 ### Added @@ -22,7 +22,10 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed -- Nothing. +- [#194](https://github.com/zendframework/zend-validator/pull/194) modifies the + `EmailAddress` validator to omit the `INTL_IDNA_VARIANT_UTS46` flag to + `idn_to_utf8()` if the constant is not defined, fixing an issue on systems + using pre-2012 releases of libicu. ## 2.10.0 - 2017-08-14 diff --git a/src/EmailAddress.php b/src/EmailAddress.php index bd58018dc..ab5e9db9b 100644 --- a/src/EmailAddress.php +++ b/src/EmailAddress.php @@ -554,7 +554,10 @@ public function isValid($value) protected function idnToAscii($email) { if (extension_loaded('intl')) { - return (idn_to_ascii($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email); + if (defined('INTL_IDNA_VARIANT_UTS46')) { + return (idn_to_ascii($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email); + } + return (idn_to_ascii($email) ?: $email); } return $email; } @@ -577,7 +580,10 @@ protected function idnToUtf8($email) // the source string in those cases. // But not when the source string is long enough. // Thus we default to source string ourselves. - return idn_to_utf8($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email; + if (defined('INTL_IDNA_VARIANT_UTS46')) { + return idn_to_utf8($email, 0, INTL_IDNA_VARIANT_UTS46) ?: $email; + } + return idn_to_utf8($email) ?: $email; } return $email; } diff --git a/src/Hostname.php b/src/Hostname.php index 1f995206d..f30c35f7b 100644 --- a/src/Hostname.php +++ b/src/Hostname.php @@ -69,7 +69,7 @@ class Hostname extends AbstractValidator /** * Array of valid top-level-domains - * IanaVersion 2017081400 + * IanaVersion 2017082200 * * @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs