From edccd5b1641bb792c795bb78aa4c2ea7d0fb5d67 Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Thu, 28 Feb 2019 23:06:28 +0100 Subject: [PATCH 1/2] [DealabsBridge] Workaround to unparsable Deal date In case of a unparsable date, the text to DateTime object failed, and this resulted to a Fatal error while using this DateTime object . To prvent this fatal error, if the date parsing failse, then a DateTime object is created with the actual date. --- bridges/DealabsBridge.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bridges/DealabsBridge.php b/bridges/DealabsBridge.php index 3427ca65d18..4a813f1e33a 100644 --- a/bridges/DealabsBridge.php +++ b/bridges/DealabsBridge.php @@ -1376,8 +1376,12 @@ private function parseDate($string) // Add the Hour and minutes $date_str .= ' 00:00'; - $date = DateTime::createFromFormat('j F Y H:i', $date_str); + // In some case, the date is not recognized : as a workaround the actual date is taken + if($date === FALSE) + { + $date = new DateTime(); + } return $date->getTimestamp(); } From 568d0ab200e6b43ff74c2a995a9f2b0152a2def0 Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Thu, 28 Feb 2019 23:23:31 +0100 Subject: [PATCH 2/2] [DealabsBridge] Coding policy fixes --- bridges/DealabsBridge.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bridges/DealabsBridge.php b/bridges/DealabsBridge.php index 4a813f1e33a..b64bb1dc957 100644 --- a/bridges/DealabsBridge.php +++ b/bridges/DealabsBridge.php @@ -1378,8 +1378,7 @@ private function parseDate($string) $date_str .= ' 00:00'; $date = DateTime::createFromFormat('j F Y H:i', $date_str); // In some case, the date is not recognized : as a workaround the actual date is taken - if($date === FALSE) - { + if($date === false) { $date = new DateTime(); } return $date->getTimestamp();