Skip to content
This repository was archived by the owner on Mar 6, 2021. It is now read-only.

Commit 77048a7

Browse files
committed
prepare 1.0.3 release
bug fix idn_to_uf8 conversion error
1 parent 4fa49db commit 77048a7

File tree

12 files changed

+52
-12
lines changed

12 files changed

+52
-12
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
All Notable changes to `League Uri Nostname parser` will be documented in this file
44

5+
## 1.0.3 - 2017-11-30
6+
7+
### Added
8+
9+
- None
10+
11+
### Fixed
12+
13+
- idn_to_utf8 public suffix conversion handle error cases
14+
15+
### Deprecated
16+
17+
- None
18+
19+
### Removed
20+
21+
- None
22+
523
## 1.0.2 - 2017-11-23
624

725
### Added

src/PublicSuffix/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/CacheException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/Domain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/HttpClientException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/ICANNSectionManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE

src/PublicSuffix/Rules.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage League\Uri\PublicSuffix
77
* @author Ignace Nyamagana Butera <nyamsprod@gmail.com>
88
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
9-
* @version 1.0.2
9+
* @version 1.0.3
1010
* @link https://github.com/thephpleague/uri-hostname-parser
1111
*
1212
* For the full copyright and license information, please view the LICENSE
@@ -84,7 +84,16 @@ private function isMatchable($domain): bool
8484
*/
8585
private function normalize(string $domain): string
8686
{
87-
return strtolower(idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46));
87+
if (false !== strpos($domain, '%')) {
88+
$domain = rawurldecode($domain);
89+
}
90+
91+
$normalize = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
92+
if (false === $normalize) {
93+
return '';
94+
}
95+
96+
return strtolower($normalize);
8897
}
8998

9099
/**
@@ -168,8 +177,12 @@ private function handleNoMatches(string $domain): Domain
168177
{
169178
$labels = explode('.', $domain);
170179
$publicSuffix = array_pop($labels);
171-
if (null !== $publicSuffix && !$this->isPunycoded($domain)) {
180+
181+
if (!$this->isPunycoded($domain)) {
172182
$publicSuffix = idn_to_utf8($publicSuffix, 0, INTL_IDNA_VARIANT_UTS46);
183+
if (false === $publicSuffix) {
184+
$publicSuffix = null;
185+
}
173186
}
174187

175188
return new Domain($domain, $publicSuffix);

0 commit comments

Comments
 (0)