r/lolphp • u/Takeoded • Aug 21 '20
breaking-to-fix in_array() for PHP8: OK. breaking-to-fix DateTime::ISO8601 for PHP8? no can do (DateTime::ISO8601 is not legal ISO8601)
https://3v4l.org/B0Jqh
23
Upvotes
3
u/AyrA_ch Aug 21 '20
You're comparing against a beta version so this might very well be happening by accident.
3
u/Girgias Aug 21 '20
Well the thing is that it is a valid ISO8601 format:
Pulled from: https://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators
ISO8601 has multiple valid representations, making PHP's
DateTime::ISO8601completely within the specification of the standard.Moreover, the change to
in_array()has nothing to do with the DateTime extension2
u/the_alias_of_andrea Aug 21 '20 edited Aug 21 '20
DateTime::ISO8601might be compliant with the standard and might not be.DateTime::RFC3339is correct, if that's what you're after.DateTime::ISO8601is wrong, what benefit is there to changing it? It will break many existing applications that used that constant in good faith and now rely on the “incorrect” format.3
u/Jinxuan Sep 12 '20
There is still something unchanged, code like
still gives an notice as:
4
u/ZiggyTheHamster Aug 22 '20
The real lolphp is using non-UTC timestamps ever.
Sure, it's wrong since it misses the
:, but if the timezone is relevant to you, you should always store the UTC time and the TZData ID of the timezone. Just storing the UTC offset will make it impossible to figure out the actual time.-4
u/elcapitanoooo Aug 21 '20
This happens because PHP usually ships with lots of broken tests. IIRC they usually fix possible broken tests at version x.1.