If you look here you can see the code from PHP 5.3 that would attempt to guess the system timezone. There isn't that much to it, but it appears the reasons for removing the guessing is mostly related to DST as that is where the issues seem to surface.
A breakdown of the whole guessing process looks like:
- Checks to see if it's already defined globally (php.ini or previous guess) (line 851-853)
- Check
TZ
environment variable (rarely ever defined from my experience) (line 855-858)
- Check
date.default_timezone
from php.ini (special case as it should already be defined) (line 860-872)
- Try to guess the timezone from the system by comparing the
time()
against the localtime()
. The spec seems to say setting the timezone is optional, as there could be issues with threaded versions of this call (line 873-890)
- Win32: Call WinAPI function
GetTimeZoneInformation()
and try to determine system time zone (line 893-928)
- Netware: Check the
_timezone
value if defined (line 929-937)
- Fallback to UTC if none of the above checks succeeded
I can only speculate, but maybe they only removed it since it was a guess to begin with and isn't always reliable.
Also due to PHP's popularity, it is installed on almost every Linux based shared hosting plan where the customers are often not in the same timezone as the server so falling back to the server timezone for those people is no better than using UTC by default. Then it only causes confusion as these customers have to come to SO to ask why the time is wrong in PHP.
I'm not familiar enough with C and the standard, but it seems like guessing timezone based on localtime
has issues with multithreaded code or isn't available in some cases. Since on non-Windows platforms, this is the best way to determine the timezone, it doesn't make sense to do if say half the time it doesn't return anything or causes problems for multi-threaded PHP.
Then of course there is the issue of DST in some places where the timezone and offset is different based on the time of year.
Hope that helps.