Projects
Kolab:Winterfell
roundcubemail
0001-Fix-parsing-date-strings-e.g.-from-a-Date-...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-parsing-date-strings-e.g.-from-a-Date-mail-heade.patch of Package roundcubemail (Revision 96)
Currently displaying revision
96
,
Show latest
From 60902de521a72b8c0d276b29300933d7cb8a9f69 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sun, 18 Mar 2018 19:22:09 +0100 Subject: [PATCH 1/4] Fix parsing date strings (e.g. from a Date: mail header) with comments (#6216) --- CHANGELOG | 2 ++ program/lib/Roundcube/rcube_utils.php | 4 +++- tests/Framework/Utils.php | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 11b12f120..650f679a6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ CHANGELOG Roundcube Webmail =========================== +- Fix parsing date strings (e.g. from a Date: mail header) with comments (#6216) + RELEASE 1.3.5 ------------- - Managesieve: Fix bug where text: syntax was forced for strings longer than 1024 characters (#6143) diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php index 916945257..d050e9895 100644 --- a/program/lib/Roundcube/rcube_utils.php +++ b/program/lib/Roundcube/rcube_utils.php @@ -795,11 +795,13 @@ class rcube_utils // Clean malformed data $date = preg_replace( array( + '/\(.*\)/', // remove RFC comments '/GMT\s*([+-][0-9]+)/', // support non-standard "GMTXXXX" literal - '/[^a-z0-9\x20\x09:+-\/]/i', // remove any invalid characters + '/[^a-z0-9\x20\x09:\/\.+-]/i', // remove any invalid characters '/\s*(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s*/i', // remove weekday names ), array( + '', '\\1', '', '', diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php index 42fbb923b..d7693268f 100644 --- a/tests/Framework/Utils.php +++ b/tests/Framework/Utils.php @@ -373,6 +373,15 @@ class Framework_Utils extends PHPUnit_Framework_TestCase $result = rcube_utils::anytodatetime($datetime); $this->assertSame($ts, $result ? $result->format('Y-m-d H:i:s') : false, "Error parsing date: $datetime"); } + + $test = array( + 'Sun, 4 Mar 2018 03:32:08 +0300 (MSK)' => '2018-03-04 03:32:08 +0300', + ); + + foreach ($test as $datetime => $ts) { + $result = rcube_utils::anytodatetime($datetime); + $this->assertSame($ts, $result ? $result->format('Y-m-d H:i:s O') : false, "Error parsing date: $datetime"); + } } /** -- 2.14.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.