mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 19:49:20 +03:00
Log RFC 2822 date parse error for #1554
This commit is contained in:
parent
53a6f04f18
commit
e9f2b71574
1 changed files with 5 additions and 0 deletions
|
|
@ -37,11 +37,16 @@ abstract class DateTimeHelper
|
|||
{
|
||||
$sDateTime = \trim($sDateTime);
|
||||
if (empty($sDateTime)) {
|
||||
\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}'");
|
||||
}
|
||||
return $oDateTime ? $oDateTime->getTimestamp() : 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue