diff --git a/CHANGELOG.md b/CHANGELOG.md index 630f8d3..d9eb64f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,24 @@ All Notable changes to `League Uri Nostname parser` will be documented in this file +## 1.0.4 - 2017-11-30 + +### Added + +- None + +### Fixed + +- Domain class with invalid domain names + +### Deprecated + +- None + +### Removed + +- None + ## 1.0.3 - 2017-11-30 ### Added diff --git a/src/Installer/ICANNSection.php b/src/Installer/ICANNSection.php index 2193aa4..8c209bf 100644 --- a/src/Installer/ICANNSection.php +++ b/src/Installer/ICANNSection.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/Cache.php b/src/PublicSuffix/Cache.php index 9702a82..a35f0b6 100644 --- a/src/PublicSuffix/Cache.php +++ b/src/PublicSuffix/Cache.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/CacheException.php b/src/PublicSuffix/CacheException.php index 89f1bcb..9385822 100644 --- a/src/PublicSuffix/CacheException.php +++ b/src/PublicSuffix/CacheException.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/CurlHttpClient.php b/src/PublicSuffix/CurlHttpClient.php index 00b5cb6..36c7cd0 100644 --- a/src/PublicSuffix/CurlHttpClient.php +++ b/src/PublicSuffix/CurlHttpClient.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/Domain.php b/src/PublicSuffix/Domain.php index d43fa13..9137507 100644 --- a/src/PublicSuffix/Domain.php +++ b/src/PublicSuffix/Domain.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE @@ -128,15 +128,21 @@ private function hasRegistrableDomain(): bool * * @param string $domain * - * @return string + * @return string|null */ - private function normalize(string $domain): string + private function normalize(string $domain) { + $func = 'idn_to_utf8'; if (strpos($domain, 'xn--') !== false) { - return strtolower(idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46)); + $func = 'idn_to_ascii'; + } + + $domain = $func($domain, 0, INTL_IDNA_VARIANT_UTS46); + if (false === $domain) { + return null; } - return idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46); + return strtolower($domain); } /** diff --git a/src/PublicSuffix/Exception.php b/src/PublicSuffix/Exception.php index 0d610ed..262ee18 100644 --- a/src/PublicSuffix/Exception.php +++ b/src/PublicSuffix/Exception.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/HttpClient.php b/src/PublicSuffix/HttpClient.php index fc75367..6f6f30b 100644 --- a/src/PublicSuffix/HttpClient.php +++ b/src/PublicSuffix/HttpClient.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/HttpClientException.php b/src/PublicSuffix/HttpClientException.php index 6244810..894b5cb 100644 --- a/src/PublicSuffix/HttpClientException.php +++ b/src/PublicSuffix/HttpClientException.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/ICANNSectionManager.php b/src/PublicSuffix/ICANNSectionManager.php index 68199ae..c8d602d 100644 --- a/src/PublicSuffix/ICANNSectionManager.php +++ b/src/PublicSuffix/ICANNSectionManager.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/PublicSuffix/Rules.php b/src/PublicSuffix/Rules.php index 5164d2b..570a217 100644 --- a/src/PublicSuffix/Rules.php +++ b/src/PublicSuffix/Rules.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/src/functions.php b/src/functions.php index aadb382..cbe244f 100644 --- a/src/functions.php +++ b/src/functions.php @@ -6,7 +6,7 @@ * @subpackage League\Uri\PublicSuffix * @author Ignace Nyamagana Butera * @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License) - * @version 1.0.3 + * @version 1.0.4 * @link https://github.com/thephpleague/uri-hostname-parser * * For the full copyright and license information, please view the LICENSE diff --git a/tests/DomainTest.php b/tests/DomainTest.php index 8337df2..840fdc6 100644 --- a/tests/DomainTest.php +++ b/tests/DomainTest.php @@ -28,6 +28,7 @@ public function invalidRegistrableDomainProvider() 'domain and suffix are the same' => ['co.uk', 'co.uk'], 'domain has no labels' => ['faketld', 'faketld'], 'public suffix is null' => ['faketld', null], + 'public suffix is invalid' => ['_b%C3%A9bé.be-', 'be-'], ]; } }