From 916c88f1b8f75ffc4ec24977095b325d1b92f824 Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Sat, 2 Mar 2019 19:10:57 +0100 Subject: [PATCH] [DealabsBridge] Patch unparsable Deal date (#1053) 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridges/DealabsBridge.php b/bridges/DealabsBridge.php index 3427ca65d18..b64bb1dc957 100644 --- a/bridges/DealabsBridge.php +++ b/bridges/DealabsBridge.php @@ -1376,8 +1376,11 @@ 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(); }