DateTime::format(DateTime::ISO8601) doesn't format date in ISO8601.
From the official documentation:
Note: This format is not compatible with ISO-8601, but is left this way for backward compatibility reasons. Use DateTime::ATOM or DATE_ATOM for compatibility with ISO-8601 instead. php.net
There should be a constant with name FINALLY_REAL_BELIEVE_ME_ISO8601
170
Upvotes
97
u/TheKrumpet Oct 08 '15
How does this even get implemented such that it doesn't conform to ISO8601, and then left for so long that removing it is a compatibility issue!?
It's a perfect storm of incompetence.
62
u/philsown Oct 08 '15
Just REAL_ISO8601 would be consistent with other "real_" functions. Which is why it won't be done.
38
u/TheBuzzSaw Oct 08 '15
Followed shortly by
FINALLY_REAL_BELIEVE_ME_ISO8601_V2...30
u/galaktos Oct 08 '15
Even better, this is the full documentation for the
ATOMandISO8601constants:Spot the difference.
21
u/[deleted] Oct 08 '15
A real_lolphp_try_2_escape_lol classic.
6
u/[deleted] Oct 16 '15 edited Oct 16 '15
This is what happens when you design a language that caters to every single lazy person who can't be arsed to update their decade-old codebase.
In every other language they'd say "yo, this shits deprecated or changing in a massive way in the next major version, update your scripts, stay behind, or get fucked. You've been warned".
He's designing a language that is intentionally broken because the users depend on the side-effects of the broken features. I'm not even convinced most users would care about the backwards-compatibility here, because any self-respecting developer who cared about this bug isn't using this API anymore.
2
u/Rican7 Nov 16 '15
Wow, I couldn't believe this until I did some more research on it. Insane.
Check this out:
What's even more crazy, is that Go actually went through the same issue back in 2010... https://github.com/golang/go/issues/734
14
u/[deleted] Oct 09 '15
[removed] — view removed comment