From: eileen Date: Thu, 1 Oct 2015 23:56:47 +0000 (+1300) Subject: CRM-17326 add isset check to timezone retrieval X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e41775f63d79a511670342443857d0efa5b43d3b;p=civicrm-core.git CRM-17326 add isset check to timezone retrieval This addresses an e-notice Change-Id: I82d3314bc2e28cca64ec9f4ed4d64477c50b7303 --- 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 {