Skip to content

Commit

Permalink
Fix undefined indices for some ccTLDs
Browse files Browse the repository at this point in the history
For some ccTLD domains, the ICANN list does not provide a TLD, such as
.cy of Cyprus. While there is www.nic.cy so unsure if this is a bug or
by design. Will have to follow up with the repo maintainers.
  • Loading branch information
flacle committed Dec 22, 2015
1 parent 5ee2ed9 commit 8f16a52
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 58 deletions.
97 changes: 44 additions & 53 deletions publicsuffixlists/public_suffix_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,22 +631,19 @@
array (
0 => 'gov.cx',
),
'cy' =>
array (
0 => 'ac.cy',
1 => 'biz.cy',
2 => 'com.cy',
3 => 'ekloges.cy',
4 => 'gov.cy',
5 => 'ltd.cy',
6 => 'name.cy',
7 => 'net.cy',
8 => 'org.cy',
9 => 'parliament.cy',
10 => 'press.cy',
11 => 'pro.cy',
12 => 'tm.cy',
),
'ac.cy' => 'ac.cy',
'biz.cy' => 'biz.cy',
'com.cy' => 'com.cy',
'ekloges.cy' => 'ekloges.cy',
'gov.cy' => 'gov.cy',
'ltd.cy' => 'ltd.cy',
'name.cy' => 'name.cy',
'net.cy' => 'net.cy',
'org.cy' => 'org.cy',
'parliament.cy' => 'parliament.cy',
'press.cy' => 'press.cy',
'pro.cy' => 'pro.cy',
'tm.cy' => 'tm.cy',
'cz' => 'cz',
'de' => 'de',
'dj' => 'dj',
Expand Down Expand Up @@ -4208,23 +4205,20 @@
7 => 'mil.ng',
8 => 'mobi.ng',
),
'ni' =>
array (
0 => 'com.ni',
1 => 'gob.ni',
2 => 'edu.ni',
3 => 'org.ni',
4 => 'nom.ni',
5 => 'net.ni',
6 => 'mil.ni',
7 => 'co.ni',
8 => 'biz.ni',
9 => 'web.ni',
10 => 'int.ni',
11 => 'ac.ni',
12 => 'in.ni',
13 => 'info.ni',
),
'com.ni' => 'com.ni',
'gob.ni' => 'gob.ni',
'edu.ni' => 'edu.ni',
'org.ni' => 'org.ni',
'nom.ni' => 'nom.ni',
'net.ni' => 'net.ni',
'mil.ni' => 'mil.ni',
'co.ni' => 'co.ni',
'biz.ni' => 'biz.ni',
'web.ni' => 'web.ni',
'int.ni' => 'int.ni',
'ac.ni' => 'ac.ni',
'in.ni' => 'in.ni',
'info.ni' => 'info.ni',
'nl' =>
array (
0 => 'bv.nl',
Expand Down Expand Up @@ -6397,26 +6391,23 @@
'اليمن' => 'اليمن',
'xxx' => 'xxx',
'ye' => 'ye',
'za' =>
array (
0 => 'ac.za',
1 => 'agrica.za',
2 => 'alt.za',
3 => 'co.za',
4 => 'edu.za',
5 => 'gov.za',
6 => 'grondar.za',
7 => 'law.za',
8 => 'mil.za',
9 => 'net.za',
10 => 'ngo.za',
11 => 'nis.za',
12 => 'nom.za',
13 => 'org.za',
14 => 'school.za',
15 => 'tm.za',
16 => 'web.za',
),
'ac.za' => 'ac.za',
'agrica.za' => 'agrica.za',
'alt.za' => 'alt.za',
'co.za' => 'co.za',
'edu.za' => 'edu.za',
'gov.za' => 'gov.za',
'grondar.za' => 'grondar.za',
'law.za' => 'law.za',
'mil.za' => 'mil.za',
'net.za' => 'net.za',
'ngo.za' => 'ngo.za',
'nis.za' => 'nis.za',
'nom.za' => 'nom.za',
'org.za' => 'org.za',
'school.za' => 'school.za',
'tm.za' => 'tm.za',
'web.za' => 'web.za',
'zm' => 'zm',
'zw' => 'zw',
'aaa' => 'aaa',
Expand Down
15 changes: 10 additions & 5 deletions src/serializeToPHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,17 @@
// Check if there are SLD+'s
if ($tldDot > 0) {
$tld = substr($line, $tldDot+1);
if (is_array($tldArr[$tld])) {
// Append to sub-array
$tldArr[$tld][] = $line;
if (isset($tldArr[$tld])) {
if (is_array($tldArr[$tld])) {
// Append to sub-array with existing values
$tldArr[$tld][] = $line;
} else {
// Init just one array with the new value
$tldArr[$tld] = array($line);
}
} else {
// Init just one array
$tldArr[$tld] = array($line);
// Store just a string, not an array
$tldArr[$line] = $line;
}
} else {
// Else just store the TLD as the key
Expand Down

0 comments on commit 8f16a52

Please sign in to comment.