diff --git a/src/utils/Timezone.php b/src/utils/Timezone.php index 1cd6677154..c5d3f01b9b 100644 --- a/src/utils/Timezone.php +++ b/src/utils/Timezone.php @@ -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']) ){