From 942b508d79b5f4f58372e912536e2269240016c8 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Wed, 13 Jan 2016 07:12:53 +0000
Subject: [PATCH] timestamp: Return empty on invalid timestamp

---
 include/class.format.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/class.format.php b/include/class.format.php
index cfb2df4f0..dda041569 100644
--- a/include/class.format.php
+++ b/include/class.format.php
@@ -522,7 +522,9 @@ class Format {
 
         $format = self::getStrftimeFormat($format);
         // Properly convert to user local time
-        $time = DateTime::createFromFormat('U', $timestamp, new DateTimeZone('UTC'));
+        if (!($time = DateTime::createFromFormat('U', $timestamp, new DateTimeZone('UTC'))))
+           return '';
+
         $offset = $user_timezone->getOffset($time);
         $timestamp = $time->getTimestamp() + $offset;
         return strftime($format ?: $strftimeFallback, $timestamp);
-- 
GitLab