Skip to content
This repository has been archived by the owner on Nov 23, 2020. It is now read-only.

Commit

Permalink
Merge 7b7c9c4 into 39a1c7b
Browse files Browse the repository at this point in the history
  • Loading branch information
BugBuster1701 committed May 29, 2017
2 parents 39a1c7b + 7b7c9c4 commit d9ea092
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/SemaltBlocker/Domainparser.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Nabble\SemaltBlocker;

use TrueBV\Punycode;
use TrueBV\Exception\LabelOutOfBoundsException;

/**
* Adapted from http://forums.devshed.com/php-development-5/root-domain-url-551863.html.
Expand Down Expand Up @@ -89,7 +90,13 @@ private static function parseUrl($url, $component)
// Punycode encode domain
$host = parse_url('http://' . $url, PHP_URL_HOST);
$punycode = new Punycode();
$url = str_replace($host, $punycode->encode($host), $url);
try {
$url = str_replace($host, $punycode->encode($host), $url);
}
catch (LabelOutOfBoundsException $e)
{

}

// Add back normalized protocol
$url = 'http://' . $url;
Expand Down

0 comments on commit d9ea092

Please sign in to comment.