PHP isn't fully supporting RFC 822 (https://bugs.php.net/bug.php?id=42486). Some (old) email severs (maybe due to some bugs) use "UT" timezone instead of "UTC". The difference is less than 1s (in the last 40 years, something between -0.6 and +0.8s).
// this returns false
\DateTime::createFromFormat(\DateTime::RFC822, 'Sun, 20 May 2012 23:08:52 UT')
// if we add a 'C' at the end and parsing it as 2822 it returns the correct date
\DateTime::createFromFormat(\DateTime::RFC2822, 'Sun, 20 May 2012 23:08:52 UTC')
The fix could be as easy as adding a 'C' at then end:
Hi,
PHP isn't fully supporting RFC 822 (https://bugs.php.net/bug.php?id=42486). Some (old) email severs (maybe due to some bugs) use "UT" timezone instead of "UTC". The difference is less than 1s (in the last 40 years, something between -0.6 and +0.8s).
The fix could be as easy as adding a 'C' at then end:
We also noticed some errors while parsing years with only 2 digits, they can be easily fixed with something like this:
Does it make sense to create a pull request for fixing it?