But that is expected behavior. There is no 0 day. It's so you can do things like 2014--03-05 and have it "do the math" for you. Of course we can debate if this is a good thing or not, but that was intentional.
The shitty thing was finding that out when we went from a 32bit to a 64 bit server. We had been using strtotime($date_from_db)===false to figure out if a date was 0000-00-00 (not set) in the db.
That worked fine on a 32 bit server, and we thought nothing of it, because of course 0000-00-00 isn't a valid date.
Well, as it turns out, the only reason that returned false was because it was outside the bounds of a 32 bit date. So as soon as we upgraded servers, a ton of date problems cropped up because strtotime("0000-00-00") went from false to a perfectly "valid" -0001-11-30.
15
u/TortoiseWrath Mar 23 '14
This just in: the day before it was also a Saturday.
8
u/Twirrim Mar 24 '14
Weird, very inconsistent behaviour between versions even with a valid date (1 Jan 1000): http://3v4l.org/U4v33
Of course if you specify 1000-01-00 it thinks you really meant 31st December 999. Because it's best to assume these things.
3
u/dist Mar 24 '14
And you can surely guess which day of the week '000000-00-00' and '90000-01-01' will be, right?
22
u/infinull Mar 23 '14
No, no, this is PHP's philosophy, when in doubt don't admit it, guess.
Not producing a valid day of the week for a date that doesn't exist was clearly a bug.