willdurand / EmailReplyParser

PHP library for parsing plain text email content.

Home Page:https://williamdurand.fr/EmailReplyParser/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed testDateQuoteHeader when day starts with 0

pbrzoski opened this issue · comments

In your test are two cases

array('2014-03-20 8:48 GMT+01:00 Rémi Dolan <do_not_reply@dolan.com>:'), // Gmail
array('2014-03-20 20:48 GMT+01:00 Rémi Dolan <do_not_reply@dolan.com>:'), // Gmail

If I add next(look on day format)

array('2014-03-09 20:48 GMT+01:00 Rémi Dolan <do_not_reply@dolan.com>:'), // Gmail

Tests are failed. I think problem is this pattern

'/^(20[0-9]{2}\-(?:0?[1-9]|1[012])\-(?:0?[1-2][0-9]|3[01]|[1-9])\s[0-2]?[0-9]:\d{2}\s.+:)$/ms', // 20YY-MM-DD HH:II GMT+01:00 NAME <EMAIL>:

Pattern for day looks like

(?:0?[1-2][0-9]|3[01]|[1-9])

In my opinion it should be

(?:0?[0-9]|[1-2][0-9]|3[01]|[1-9])

wow, really? then, we must fix that asap