Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Bugfix Log RFC 2822 date parse error for #1554
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Apr 30, 2024
1 parent 73ac962 commit 6cafd65
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public static function ParseRFC2822DateString(string $sDateTime) : int
{
$sDateTime = \trim($sDateTime);
if (empty($sDateTime)) {
\SnappyMail\Log::info("No RFC 2822 date to parse");
\SnappyMail\Log::info('', "No RFC 2822 date to parse");
return 0;
}

$sDateTime = \trim(\preg_replace('/ \([a-zA-Z0-9]+\)$/', '', $sDateTime));
$oDateTime = \DateTime::createFromFormat(\DateTime::RFC2822, $sDateTime, static::GetUtcTimeZoneObject());
// 398045302 is 1982-08-13 00:08:22 the date RFC 822 was created
if (!$oDateTime || 398045302 > $oDateTime->getTimestamp()) {
\SnappyMail\Log::notice("Failed to parse RFC 2822 date '{$sDateTime}'");
\SnappyMail\Log::notice('', "Failed to parse RFC 2822 date '{$sDateTime}'");
}
return $oDateTime ? $oDateTime->getTimestamp() : 0;
}
Expand Down

0 comments on commit 6cafd65

Please sign in to comment.