From e41775f63d79a511670342443857d0efa5b43d3b Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 2 Oct 2015 12:56:47 +1300 Subject: [PATCH] CRM-17326 add isset check to timezone retrieval This addresses an e-notice Change-Id: I82d3314bc2e28cca64ec9f4ed4d64477c50b7303 --- CRM/Utils/System/Drupal.php | 3 ++- CRM/Utils/System/Drupal6.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Utils/System/Drupal.php b/CRM/Utils/System/Drupal.php index d189ddd55c..f98b0a2ebe 100644 --- a/CRM/Utils/System/Drupal.php +++ b/CRM/Utils/System/Drupal.php @@ -764,7 +764,8 @@ AND u.status = 1 */ public function getTimeZoneString() { global $user; - if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + // Note that 0 is a valid timezone (GMT) so we use strlen not empty to check. + if (variable_get('configurable_timezones', 1) && $user->uid && isset($user->timezone) && strlen($user->timezone)) { $timezone = $user->timezone; } else { diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index 3e97055860..60da7ae2c4 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -726,7 +726,8 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { */ public function getTimeZoneString() { global $user; - if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + // Note that 0 is a valid timezone (GMT) so we use strlen not empty to check. + if (variable_get('configurable_timezones', 1) && $user->uid && isset($user->timezone) && strlen($user->timezone)) { $timezone = $user->timezone; } else { -- 2.25.1