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
99{
1010 private $ info ;
1111 private $ url ;
12- private static $ public_suffix_list ;
12+ private static $ public_suffix_list = [] ;
1313
1414 /**
1515 * Create a new Url instance.
@@ -223,7 +223,7 @@ public function getDomain($first_level = false)
223223 $ tld = $ host [1 ].'. ' .$ host [0 ];
224224 $ suffixes = self ::getSuffixes ();
225225
226- if (in_array ($ tld , ( array ) $ suffixes , true )) {
226+ if (in_array ($ tld , $ suffixes , true )) {
227227 return $ first_level ? $ host [2 ].'. ' .$ tld : $ host [2 ];
228228 }
229229
@@ -619,8 +619,13 @@ private function setPath($path)
619619
620620 private static function getSuffixes ()
621621 {
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+ }
624629 }
625630
626631 return self ::$ public_suffix_list ;
You can’t perform that action at this time.
0 commit comments