Timezone: explicitly check result of getURL()

phpstan-strict-rules should report this, but it doesn't ...
This commit is contained in:
Dylan K. Taylor 2020-10-09 17:23:22 +01:00
parent 78f4fcf6ab
commit 873535f719

View File

@ -88,7 +88,7 @@ abstract class Timezone{
break;
}
if($response = Internet::getURL("http://ip-api.com/json") //If system timezone detection fails or timezone is an invalid value.
if(($response = Internet::getURL("http://ip-api.com/json")) !== false //If system timezone detection fails or timezone is an invalid value.
and $ip_geolocation_data = json_decode($response, true)
and $ip_geolocation_data['status'] !== 'fail'
and date_default_timezone_set($ip_geolocation_data['timezone'])