Timezone: fix some implicit boolean type conversions

This commit is contained in:
Dylan K. Taylor 2021-08-21 15:43:30 +01:00
parent 686bf398d5
commit 5f3c9e6f19
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -76,7 +76,7 @@ abstract class Timezone{
}
}
if(($timezone = self::detectSystemTimezone()) and date_default_timezone_set($timezone)){
if(($timezone = self::detectSystemTimezone()) !== false and date_default_timezone_set($timezone)){
//Success! Timezone has already been set and validated in the if statement.
//This here is just for redundancy just in case some program wants to read timezone data from the ini.
ini_set("date.timezone", $timezone);
@ -84,7 +84,7 @@ abstract class Timezone{
}
if(($response = Internet::getURL("http://ip-api.com/json")) !== null //If system timezone detection fails or timezone is an invalid value.
and $ip_geolocation_data = json_decode($response->getBody(), true)
and is_array($ip_geolocation_data = json_decode($response->getBody(), true))
and $ip_geolocation_data['status'] !== 'fail'
and date_default_timezone_set($ip_geolocation_data['timezone'])
){