6.0.0-alpha14
6/30/25

[#13409] IMP dies on bad date headers
Summary IMP dies on bad date headers
Queue IMP
Queue Version 6.1.7
Type Bug
State Not A Bug
Priority 1. Low
Owners
Requester bra (at) fsn (dot) hu
Created 07/31/2014 (3987 days ago)
Due
Updated 08/02/2014 (3985 days ago)
Assigned 07/31/2014 (3987 days ago)
Resolved 08/02/2014 (3985 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
08/02/2014 09:54:02 PM bra (at) fsn (dot) hu Comment #6 Reply to this comment
Your version of PHP is broken.  This is worked around in 
Horde_Imap_Client 2.22.0+.
Indeed, upgrading to 5.5.14 solves this issue. Thanks.
08/02/2014 06:24:07 PM Michael Slusarz Comment #5
State ⇒ Not A Bug
Reply to this comment
Your version of PHP is broken.  This is worked around in 
Horde_Imap_Client 2.22.0+.
08/01/2014 07:44:47 AM bra (at) fsn (dot) hu Comment #4 Reply to this comment
Can't reproduce.  AFAICT, envelope->date cannot be anything other 
than a Horde_Imap_Client_DateTime object.

Considering that we catch/fix precisely the broken date headers you 
report in Horde_Imap_Client, I'm wondering if you happen to be using 
PHP 5.4.29, 5.5.13, or 5.6?
# php -v
PHP 5.5.13 (cli) (built: Jun 10 2014 15:36:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
     with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend 
Technologies

Could you please help in narrowing down this issue?
Maybe with a sample code, which can be fed with a text input and does 
the same like Horde.
07/31/2014 08:09:36 PM Michael Slusarz Comment #3
State ⇒ Feedback
Priority ⇒ 1. Low
Reply to this comment
Can't reproduce.  AFAICT, envelope->date cannot be anything other than 
a Horde_Imap_Client_DateTime object.

Considering that we catch/fix precisely the broken date headers you 
report in Horde_Imap_Client, I'm wondering if you happen to be using 
PHP 5.4.29, 5.5.13, or 5.6?
07/31/2014 03:07:40 PM bra (at) fsn (dot) hu Comment #2 Reply to this comment

[Show Quoted Text - 21 lines]
After reading my own message: "around this code" really means 
imp/lib/Ajax/Application/ShowMessage.php and this loop:
         /* Build the rest of the headers. */
         foreach ($headers_list as $head => $str) {
             if ($val = $mime_headers->getValue($head)) {
                 if ($head == 'date') {
                     /* Add local time to date header. */
                     $val = 
htmlspecialchars($imp_ui->getLocalTime($this->_envelope->date));

$this->_envelope->date here is an empty string on bad date headers, 
that's where getLocalTime dies.
07/31/2014 02:59:19 PM bra (at) fsn (dot) hu Comment #1
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ IMP dies on bad date headers
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
I have a user, converted from another mail application to Horde, who 
complains about not being able to read his mails.
When he tries to access some of them, he gets server communication error.

The following are in the logs:
Jul 31 16:47:26 wm Webmail: [imp] PHP ERROR: strftime() expects 
parameter 2 to be long, string given [pid 79051 on line 178 of 
"/usr/local/www/webmail/web/imp/lib/Message/Ui.php"]
Jul 31 16:47:26 wm Webmail: PHP Fatal error:  Call to a member 
function format() on a non-object in 
/usr/local/www/webmail/web/imp/lib/Message/Ui.php on line 181

Putting some debug syslogs around this code it seems 
$this->_envelope->date becomes an empty string when the date header is 
invalid.
Two examples from the user's folder:
Date: Tue, 22 Oct 2013 19:02:07 +0200 (GMT+02:00)
Date: Wed, 02 Jul 2014 05:18:27 UT

If I correct these headers to be RFC conform, the messages can be read.
Thunderbird and other clients can show these correctly.

Saved Queries