Ticket #1485035 (closed Bugs: duplicate)

Opened 7 months ago

Last modified 6 months ago

MySQL insert error on mails with bad dates in headers

Reported by: Dmitry.Stolyarov Owned by:
Priority: 8 Milestone: 0.2-alpha
Component: IMAP connection Version: 0.1.1
Severity: major Keywords:
Cc:

Description

If we have message with header like this:

Date: Fri, 28 Aug 2099 09:42:40 -0000

This cause not setting timestamp (function iil_StrToTime returning false) in /program/lib/imap.inc:1609.

If timestamp of the message is not set (or is set with a bool value) in /program/include/rcube_imap.inc:2203 we will have generation of SQL query with FROM_UNIXTIME() with no args ($this->db->fromunixtime($headers->timestamp) => "FROM_UNIXTIME()").

Then, after false in /program/include/rcube_mdb2.inc:259 RoundCube ends execution with errorcode 500.

I fix this problem with short patch:

*** patched/program/lib/imap.inc	2008-05-01 05:02:45.217210947 +0400
--- orig/program/lib/imap.inc	2008-04-05 16:49:21.000000000 +0400
***************
*** 1753,1757 ****
  					$result[$id]->internaldate = $time_str;
  					
! 					if ($IMAP_USE_INTERNAL_DATE || empty($result[$id]->date) || $result[$id]->timestamp === false) {
  						//calculate timestamp
  						$timestamp     = strtotime($time_str); //return's server's time
--- 1753,1757 ----
  					$result[$id]->internaldate = $time_str;
  					
! 					if ($IMAP_USE_INTERNAL_DATE || empty($result[$id]->date)) {
  						//calculate timestamp
  						$timestamp     = strtotime($time_str); //return's server's time

I think this is not good patch. Much better will be fixing iil_StrToTime function. (But it works for me now.)

P.S. Problem occurs only with $rcmail_configenable_caching? = TRUE.

Change History

Changed 6 months ago by thomasb

  • status changed from new to closed
  • resolution set to duplicate

Duplicate of #1485055 and fixed in r1390.

Note: See TracTickets for help on using tickets.