From e78fb67aa780da073fcf2b16a922ba3ef62e99f1 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 18 Sep 2015 16:03:45 -0500
Subject: [PATCH] db: Translate abbreviations like 'CDT'

---
 include/class.timezone.php | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/class.timezone.php b/include/class.timezone.php
index 79789f4f4..272444b45 100644
--- a/include/class.timezone.php
+++ b/include/class.timezone.php
@@ -166,7 +166,15 @@ class DbTimezone {
         // Attempt to fetch timezone direct from the database
         $TZ = db_timezone();
 
-        // SYSTEM does not describe a time zone
+        // Forbid timezone abbreviations like 'CDT'
+        if (!in_array($TZ, array('UTC', 'GMT')) && strpos($TZ, '/') === false)
+            // Attempt to lookup based on the abbreviation
+            if (!($TZ = timezone_name_from_abbr($TZ)))
+                // Abbreviation doesn't point to anything valid
+                return false;
+
+        // SYSTEM does not describe a time zone, ensure we have a valid zone
+        // by attempting to create an instance of DateTimeZone()
         try {
             new DateTimeZone($TZ);
             return $TZ;
-- 
GitLab