Skip to content

Commit

Permalink
[DealabsBridge] Patch unparsable Deal date (RSS-Bridge#1053)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sysadminstory authored and logmanoriginal committed Mar 2, 2019
1 parent 01da56d commit 916c88f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bridges/DealabsBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 916c88f

Please sign in to comment.