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

Commit

Permalink
Make only ASCII TLDs uppercase
Browse files Browse the repository at this point in the history
  • Loading branch information
BreyndotEchse committed Apr 26, 2016
1 parent 86e023c commit 6e43a59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Hostname.php
Original file line number Diff line number Diff line change
Expand Up @@ -1772,13 +1772,15 @@ public function isValid($value)
// id-prefix: alpha / digit
// ldh: alpha / digit / dash

$this->tld = strtoupper($matches[1]);
$this->tld = $matches[1];
// Decode Punycode TLD to IDN
if (strpos($this->tld, 'xn--') === 0) {
$this->tld = $this->decodePunycode(substr($this->tld, 4));
if ($this->tld === false) {
return false;
}
} else {
$this->tld = strtoupper($this->tld);
}

// Match TLD against known list
Expand Down

0 comments on commit 6e43a59

Please sign in to comment.