02 October 2008

The PHP Driven World Will End in 2037!


PHP / Unix seems to have its very own Y2K bug. Except it will happen in 2037.If you try and do any date/time calculations greater than 2037 with PHP it freaks out and goes back to 1 Jan 1970!

I am currenlty writing a bookings application and was playing with the calendar and checking out the future. All of a sudden when I went past the year 2037 the system would jump back to 1970!

Apparently this is a known but and is a limitation in counter that is 32bits long. (http://bugs.php.net/bug.php?id=7103)
Apparently 64bit machines are not vulnerable to this.

After doing some reading it would seem that this is indeed the Unix equivilent of the Y2K Bug!

So the moral of the story is that in the year 2038 you better make sure that you have a 64bit machine if you are running any unix based machines. Also make sure that the time_t is set to 64bit !


No comments: