Aleksander Machniak
2013-04-15 b7570fb564b0923c28ab3507b6826fd0be874c78
Fix parsing invalid date string (#1489035)
3 files modified
33 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_imap_generic.php 16 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_utils.php 16 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Fix parsing invalid date string (#1489035)
- Add "with attachment" option to messages list filter (#1485382)
- Set minimal permissions to temp files (#1488996)
- Improve content check for embedded images without filename (#1489029)
program/lib/Roundcube/rcube_imap_generic.php
@@ -3667,8 +3667,20 @@
     */
    static function strToTime($date)
    {
        // support non-standard "GMTXXXX" literal
        $date = preg_replace('/GMT\s*([+-][0-9]+)/', '\\1', $date);
        // Clean malformed data
        $date = preg_replace(
            array(
                '/GMT\s*([+-][0-9]+)/',                     // support non-standard "GMTXXXX" literal
                '/[^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',
                '',
                '',
            ), $date);
        $date = trim($date);
        // if date parsing fails, we have a date in non-rfc format
        // remove token from the end and try again
program/lib/Roundcube/rcube_utils.php
@@ -729,8 +729,20 @@
            return $date;
        }
        // support non-standard "GMTXXXX" literal
        $date = preg_replace('/GMT\s*([+-][0-9]+)/', '\\1', $date);
        // Clean malformed data
        $date = preg_replace(
            array(
                '/GMT\s*([+-][0-9]+)/',                     // support non-standard "GMTXXXX" literal
                '/[^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',
                '',
                '',
            ), $date);
        $date = trim($date);
        // if date parsing fails, we have a date in non-rfc format.
        // remove token from the end and try again