Doc #78603 [Com]: DateTime::createFromFormat() missing component behaviour change

[email protected] ("master dot training365 at gmail dot com") Mon, 14 Feb 2022 03:55:25 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=78603&edit=1

 ID:                 78603
 Comment by:         master dot training365 at gmail dot com
 Reported by:        chris dot smith at widerplan dot com
 Summary:            DateTime::createFromFormat() missing component
                     behaviour change
 Status:             Open
 Type:               Documentation Problem
 Package:            Date/time related
 Operating System:   Linux
 PHP Version:        7.3.10
 Block user comment: N
 Private report:     N

 New Comment:

https://bit.ly/3JuCd5z
https://bit.ly/3uJvgJL
https://bit.ly/34TY6vQ
https://bit.ly/33lVoPy
https://bit.ly/3BjL5YD


Previous Comments:
------------------------------------------------------------------------
[2022-02-14 03:49:46] master dot training365 at gmail dot com

https://pastelink.net/0ooxqggm
http://glintpost.pbworks.com/w/page/147983907/new14
https://groups.google.com/g/soc.history.ancient/c/k9qBuUivgko
https://grammar.lt.cityu.edu.hk/?qa=user/glintpost/wall

------------------------------------------------------------------------
[2022-02-14 03:21:45] master dot training365 at gmail dot com

http://glintpost.pbworks.com/w/page/147983811/new13
https://pastelink.net/mq68htx2
https://groups.google.com/g/soc.history.ancient/c/k9qBuUivgko

------------------------------------------------------------------------
[2022-02-14 03:16:34] master dot training365 at gmail dot com

https://grammar.lt.cityu.edu.hk/?qa=user/glintpost/wall

------------------------------------------------------------------------
[2022-02-14 03:15:58] master dot training365 at gmail dot com

http://glintpost.pbworks.com/w/page/147983781/new12
https://pastelink.net/fpc3dik4
https://groups.google.com/g/soc.history.ancient/c/k9qBuUivgko

------------------------------------------------------------------------
[2019-09-30 11:02:56] chris dot smith at widerplan dot com

> Testing it against anything pre 7.3 and it works as the documentation shows.

If you do DateTime::createFromFormat('s', '12'); then the other parts of the time component are set to zero, i.e. the epoch this has been the same since 5.3 which does not follow the documentation. As of 7.3 `u` now works the same as seconds/minutes/hours, question is which behaviour is correct.

My thinking is that it should do what the documentation says but it's been broken so long and nobody has noticed it, that it makes more sense to change the documentation to match reality.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=78603


--
Edit this bug report at https://bugs.php.net/bug.php?id=78603&edit=1