File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ class Url
9
9
{
10
10
private $ info ;
11
11
private $ url ;
12
- private static $ public_suffix_list ;
12
+ private static $ public_suffix_list = [] ;
13
13
14
14
/**
15
15
* Create a new Url instance.
@@ -223,7 +223,7 @@ public function getDomain($first_level = false)
223
223
$ tld = $ host [1 ].'. ' .$ host [0 ];
224
224
$ suffixes = self ::getSuffixes ();
225
225
226
- if (in_array ($ tld , ( array ) $ suffixes , true )) {
226
+ if (in_array ($ tld , $ suffixes , true )) {
227
227
return $ first_level ? $ host [2 ].'. ' .$ tld : $ host [2 ];
228
228
}
229
229
@@ -619,8 +619,13 @@ private function setPath($path)
619
619
620
620
private static function getSuffixes ()
621
621
{
622
- if (self ::$ public_suffix_list === null ) {
623
- self ::$ public_suffix_list = include __DIR__ .'/../resources/public_suffix_list.php ' ;
622
+
623
+ if (count (self ::$ public_suffix_list ) === 0 ) {
624
+ $ suffixes = @include __DIR__ .'/../resources/public_suffix_list.php ' ;
625
+
626
+ if (is_array ($ suffixes )) {
627
+ self ::$ public_suffix_list = $ suffixes ;
628
+ }
624
629
}
625
630
626
631
return self ::$ public_suffix_list ;
You can’t perform that action at this time.
0 commit comments