Why PHP is utterly broken

Mon, 30. Mar 2015

Categories: en development Tags: Date HTTP Header Last-Modified PHP RFC RFC1123 RFC2616 RFC7231 RFC7232 W3C

_tl;dr:_ neither does DATE_RFC1123 produce a rfc1123-date, nor does DATE_RFC850rfc850-date. What sense does that make?

This example may look scrupulous but seems typical.

Mind the mandatory word GMT at the end of rfc1123-date. While DATE_RFC1123 renders something ending with +0000. Which is the same timezone but not the same string.

So DATE_RFC1123 is useless for HTTP headers (RFC2616). I wonder what else it should be there for.

While this isn’t an issue of PHP (the language) itself, it’s IMO typical for the actual PHP code existing. It does work somehow, despite the fact that it’s totally agnostic of the basics it claims to be based upon. So it may fail any given, unforeseeable, moment, when any of the implicitly assumed side-conditions change.

P.S.: The newer RFC7231 (HTTP-Date) and e.g. RFC 7232, Last-Modified don’t change a thing.

P.P.S.: I don’t do PHP, I just came across when patching https://github.com/mro/Shaarli a bit.

Update: Another nice one.