php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79939 RFC 822 and 2822 missing from DateTime "Compound Formats"
Submitted: 2020-08-06 12:39 UTC Modified: 2020-08-06 19:30 UTC
From: thomas at landauer dot at Assigned:
Status: Open Package: Date/time related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: thomas at landauer dot at
New email:
PHP Version: OS:

 

 [2020-08-06 12:39 UTC] thomas at landauer dot at
Description:
------------
Passing an RFC 822 or RFC 2822 formatted DateTime string into the DateTime() constructor works, but it's not documented at https://www.php.net/manual/datetime.formats.compound.php

However, there are constants for both, and they are mentioned at https://www.php.net/manual/class.datetime.php

Test script:
---------------
// RFC 822:
new DateTime('Mon, 15 Aug 05 15:52:01 +0000');

// RFC 2822:
new DateTime('Mon, 15 Aug 2005 15:52:01 +0000');


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-06 18:59 UTC] requinix@php.net
Because those formats don't need any special handling. They're just regular date strings. Notice how the other RFCs aren't mentioned either?
 [2020-08-06 19:15 UTC] thomas at landauer dot at
Well, OK, but when a page starts with "This page describes the different compound date/time formats that the [...] parser understands.", I'd expect that this is a *complete* list of everything the parser understands.

So you could at least add a note like "Plus all RFC formats mentioned at https://www.php.net/manual/en/class.datetime.php "
 [2020-08-06 19:30 UTC] requinix@php.net
That's basically what I was thinking too.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 23:01:24 2020 UTC