From 5f3c9e6f19cf4b0a35e0d7deb188a6a7e79097ba Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 21 Aug 2021 15:43:30 +0100 Subject: [PATCH] Timezone: fix some implicit boolean type conversions --- src/utils/Timezone.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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']) ){