Prerequisites
Describe the issue
This is in regards to the zipdownload plugin's Export -> Mbox format. Each email in this format is prefaced by an arrival-time header:
From user@example.com Sat Apr 18 14:19:20 2026
The header doesn't include a timezone, but I believe the intent is for UTC?
In zipdownload, this line is formatted by:
|
$timezone = new \DateTimeZone('UTC'); |
|
$date = rcube_utils::anytodatetime($headers->internaldate, $timezone); |
|
if ($date) { |
|
$date = $date->format(self::MBOX_DATE_FORMAT); |
|
} |
Which calls into rcube_utils::anytodatetime:
|
if (!empty($date)) { |
|
try { |
|
$_date = preg_match('/^[0-9]+$/', $date) ? "@{$date}" : $date; |
|
$dt = $timezone ? new \DateTime($_date, $timezone) : new \DateTime($_date); |
|
} catch (\Exception $e) { |
|
// ignore |
|
} |
|
} |
|
|
|
// try our advanced strtotime() method |
|
if (!$dt && ($timestamp = self::strtotime($date, $timezone))) { |
|
try { |
|
$dt = new \DateTime('@' . $timestamp); |
|
if ($timezone) { |
|
$dt->setTimezone($timezone); |
|
} |
Typically, line 1176 above succeeds in parsing a string from IMAP, however if that string contains a timezone, the DateTimeZone('UTC') parameter is ignored. This is returned and format()ed by zipdownload without any timezone string, however the DateTime object still stores the originally parsed timezone, and the resulting string is in that timezone.
Note also that if the initial conversion in anytodatetime() fails and strtotime succeeds instead, the result is converted to the requested timezone on line 1187.
Should line 1187 apply to both cases in anytodatetime()? Should zipdownload call setTimezone() instead?
What browser(s) are you seeing the problem on?
Chrome
What version of PHP are you using?
v8.3
What version of Roundcube are you using?
v1.7-rc6
JavaScript errors
No response
PHP errors
No response
Prerequisites
Describe the issue
This is in regards to the zipdownload plugin's
Export -> Mbox format. Each email in this format is prefaced by an arrival-time header:The header doesn't include a timezone, but I believe the intent is for UTC?
In zipdownload, this line is formatted by:
roundcubemail/plugins/zipdownload/zipdownload.php
Line 238 in 018bcf7
roundcubemail/plugins/zipdownload/zipdownload.php
Lines 261 to 264 in 018bcf7
Which calls into
rcube_utils::anytodatetime:roundcubemail/program/lib/Roundcube/rcube_utils.php
Lines 1173 to 1188 in 018bcf7
Typically, line 1176 above succeeds in parsing a string from IMAP, however if that string contains a timezone, the
DateTimeZone('UTC')parameter is ignored. This is returned andformat()ed by zipdownload without any timezone string, however theDateTimeobject still stores the originally parsed timezone, and the resulting string is in that timezone.Note also that if the initial conversion in
anytodatetime()fails andstrtotimesucceeds instead, the result is converted to the requested timezone on line 1187.Should line 1187 apply to both cases in
anytodatetime()? Should zipdownload callsetTimezone()instead?What browser(s) are you seeing the problem on?
Chrome
What version of PHP are you using?
v8.3
What version of Roundcube are you using?
v1.7-rc6
JavaScript errors
No response
PHP errors
No response