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

[email protected] ("master dot training365 at gmail dot com") Mon, 14 Feb 2022 03:16:34 +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://grammar.lt.cityu.edu.hk/?qa=user/glintpost/wall


Previous Comments:
------------------------------------------------------------------------
[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.

------------------------------------------------------------------------
[2019-09-30 08:48:20] insidion at gmail dot com

This is absolutely a bug.

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

------------------------------------------------------------------------
[2019-09-27 14:11:52] chris dot smith at widerplan dot com

You are probably correct about it being documentation but there could also be some tests added to ensure the behaviour does not change in future.

------------------------------------------------------------------------
[2019-09-27 14:05:37] [email protected]

If it's been this way since PHP 5.3 then the problem is the documentation.

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


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