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

Commit

Permalink
prepare 1.0.3 release
Browse files Browse the repository at this point in the history
bug fix idn_to_uf8 conversion error
  • Loading branch information
nyamsprod committed Nov 30, 2017
1 parent 4fa49db commit 77048a7
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 12 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

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

## 1.0.3 - 2017-11-30

### Added

- None

### Fixed

- idn_to_utf8 public suffix conversion handle error cases

### Deprecated

- None

### Removed

- None

## 1.0.2 - 2017-11-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/CacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/CurlHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/Domain.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/HttpClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
2 changes: 1 addition & 1 deletion src/PublicSuffix/ICANNSectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
19 changes: 16 additions & 3 deletions src/PublicSuffix/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down Expand Up @@ -84,7 +84,16 @@ private function isMatchable($domain): bool
*/
private function normalize(string $domain): string
{
return strtolower(idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46));
if (false !== strpos($domain, '%')) {
$domain = rawurldecode($domain);
}

$normalize = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
if (false === $normalize) {
return '';
}

return strtolower($normalize);
}

/**
Expand Down Expand Up @@ -168,8 +177,12 @@ private function handleNoMatches(string $domain): Domain
{
$labels = explode('.', $domain);
$publicSuffix = array_pop($labels);
if (null !== $publicSuffix && !$this->isPunycoded($domain)) {

if (!$this->isPunycoded($domain)) {
$publicSuffix = idn_to_utf8($publicSuffix, 0, INTL_IDNA_VARIANT_UTS46);
if (false === $publicSuffix) {
$publicSuffix = null;
}
}

return new Domain($domain, $publicSuffix);
Expand Down
2 changes: 1 addition & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @subpackage League\Uri\PublicSuffix
* @author Ignace Nyamagana Butera <[email protected]>
* @license https://github.com/thephpleague/uri-hostname-parser/blob/master/LICENSE (MIT License)
* @version 1.0.2
* @version 1.0.3
* @link https://github.com/thephpleague/uri-hostname-parser
*
* For the full copyright and license information, please view the LICENSE
Expand Down
9 changes: 9 additions & 0 deletions tests/RulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ public function testSudDomainIsNull()
$this->assertNull($domain->getSubDomain());
}

public function testWithInvalidDomainName()
{
$domain = $this->rules->resolve('_b%C3%A9bé.be-');
$this->assertSame('_b%C3%A9bé.be-', $domain->getDomain());
$this->assertFalse($domain->isValid());
$this->assertNull($domain->getPublicSuffix());
$this->assertNull($domain->getRegistrableDomain());
}

/**
* @dataProvider parseDataProvider
* @param mixed $publicSuffix
Expand Down

0 comments on commit 77048a7

Please sign in to comment.