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

URGENT: The timezone could not be found in the database #135

Closed
lrpasquetto opened this issue Sep 13, 2016 · 3 comments
Closed

URGENT: The timezone could not be found in the database #135

lrpasquetto opened this issue Sep 13, 2016 · 3 comments

Comments

@lrpasquetto
Copy link

I have a client that has more than 20,000 emails, it keeps the server to control backups.
I'm riding a webmail for my clients and some messages when I read , accuses the following error:

Exception in Headers.php line 56: DateTime::__construct(): Failed to parse time string (Fri, 14 Mar 14 16:19:14 Hora oficial do Brasil) at position 24 (H): The timezone could not be found in the database

  • in Headers.php line 56
  • at DateTime->__construct('Fri, 14 Mar 14 16:19:14 Hora oficial do Brasil') in Headers.php line 56
  • at Headers->parseHeader('date', 'Fri, 14 Mar 14 16:19:14 Hora oficial do Brasil') in Headers.php line 23
  • at Headers->__construct(object(stdClass)) in Message.php line 185
  • at Message->getHeaders() in Message.php line 170
  • at Message->getSubject() in HomeController.php line 179
@ddeboer
Copy link
Owner

ddeboer commented Sep 14, 2016

That’s a weird timezone. Which mailserver produces those dates?

What we could do, is wrap the DateTime construction in a try/catch and just leave the date header empty if it fails.

@Slamdunk
Copy link
Collaborator

Hi @lrpasquetto can you provide the message raw headers (with sensitive data obscured) that produced the issue?

Slamdunk added a commit that referenced this issue Sep 28, 2017
Parse all email type headers
Closes #96 #135
@Slamdunk
Copy link
Collaborator

Slamdunk commented Sep 28, 2017

@lrpasquetto We have added in #199 various weird date time format found in production email:

imap/tests/MessageTest.php

Lines 302 to 315 in aac8f58

/**
* @see https://gist.github.com/mikesart/b33762363153e2b8c7c7
*/
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 will ever get again the mail that produces the error we'll be happy to put it in the cases tested.
Until that time, I'm closing this stalled issue.

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

3 participants