Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal error Failed to parse time string in ddeboer/imap/src/Message.php #89

Closed
skynet opened this issue Jul 7, 2015 · 2 comments
Closed

Comments

@skynet
Copy link

skynet commented Jul 7, 2015

Exception detected at line 385 in /var/www/app/test.php :
exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Fri, 24 Jul 2015 20:36:59 -0-100 -0700) at position 33 (-): Double timezone specification' in /var/www/app/vendor/ddeboer/imap/src/Message/Headers.php:56
Stack trace:
#0 /var/www/app/vendor/ddeboer/imap/src/Message/Headers.php(56): DateTime->__construct('Fri, 24 Jul 201...')
#1 /var/www/app/vendor/ddeboer/imap/src/Message/Headers.php(23): Ddeboer\Imap\Message\Headers->parseHeader('date', 'Fri, 24 Jul 201...')
#2 /var/www/app/vendor/ddeboer/imap/src/Message.php(185): Ddeboer\Imap\Message\Headers->__construct(Object(stdClass))
#3 /var/www/app/vendor/ddeboer/imap/src/Message.php(56): Ddeboer\Imap\Message->getHeaders()
#4 /var/www/app/vendor/emailapi/inboxwatch/src/InboxWatch.php(383): Ddeboer\Imap\Message->getFrom()
#5 /var/www/app/test.php(44): MyApp->imap_retrieve()
@Slamdunk
Copy link
Collaborator

That seems an invalid Date header: can you provide the raw message headers?

@Slamdunk
Copy link
Collaborator

Dates are now extensively tested:

imap/tests/MessageTest.php

Lines 320 to 330 in 6ae87c9

public function provideDateCases(): array
{
return [
['2017-09-28T09:24:01+0000', 'Thu, 28 Sep 2017 09:24:01 +0000 (UTC)'],
['2014-06-13T17:18:44+0200', '=?ISO-8859-2?Q?Fri,_13_Jun_2014_17:18:44_+020?=' . "\r\n" . ' =?ISO-8859-2?Q?0_(St=F8edn=ED_Evropa_(letn=ED_=E8as))?='],
['2008-02-13T02:15:46+0000', '13 Feb 08 02:15:46'],
['2008-04-03T12:36:15-0700', '03 Apr 2008 12:36:15 PDT'],
['2004-08-12T23:38:38-0700', 'Thu, 12 Aug 2004 11:38:38 PM -0700 (PDT)'],
['2006-01-04T21:47:28+0000', 'WED 04, JAN 2006 21:47:28'],
];
}

If you'll ever encounter this message again please ping me.

Still, now you can catch invalid date header with InvalidDateHeaderException: #205

Thank you for your feedback.

@Slamdunk Slamdunk added this to the 1.0 milestone Sep 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants