ID: 44380 Updated by: [EMAIL PROTECTED] Reported By: tessone at polyglut dot net -Status: Open +Status: Feedback Bug Type: Date/time related Operating System: CentOS PHP Version: 5.2.5 Assigned To: jani New Comment:
And main httpd.conf doesn't do any includes to add some extra conf parts..? (just to be sure here..you could try the latest snapshot JIC, some fixes were committed just last week) Previous Comments: ------------------------------------------------------------------------ [2008-03-17 03:27:19] tessone at polyglut dot net Nope, nothing like that in the main httpd.conf and no .htaccess files involved at all. ------------------------------------------------------------------------ [2008-03-14 12:11:56] [EMAIL PROTECTED] If you're using Apache, please check that there is no php_value/php_admin_value settings used in any vhost/directory (.htaccess/httpd.conf) to set the timezone. ------------------------------------------------------------------------ [2008-03-13 18:53:03] tessone at polyglut dot net As you can see from the sample code above, I haven't set date.timezone. If I do set it, the erratic behavior stops. However, it is a bug that without setting the timezone explicitly, the behavior is erratic and unpredictable. It should default to either UTC or the system timezone, but it definitely should not alternate randomly between the two. ------------------------------------------------------------------------ [2008-03-13 12:08:05] [EMAIL PROTECTED] How/where do you set date.timezone ? ------------------------------------------------------------------------ [2008-03-09 00:33:27] tessone at polyglut dot net Description: ------------ When using localtime() to get the server time into an array, sometimes PHP chooses the local timezone, sometimes it chooses GMT. I am in US/Eastern (-0500), so after 7pm, sometimes my script says it's today, sometimes tomorrow (because it is choosing GMT). Below is some code, plus a result from when it chooses the local timezone (correct) and one where it chooses GMT (incorrect). If I run date at the command-line, it consistently returns a US/Eastern time, so the server is not skipping back and forth between timezones for any reason. Reproduce code: --------------- print time() . ": "; $serverTime = localtime(time()); print_r($serverTime); print date("O"); Expected result: ---------------- 1205022657: Array ( [0] => 57 [1] => 30 [2] => 19 [3] => 8 [4] => 2 [5] => 108 [6] => 6 [7] => 67 [8] => 0 ) -0500 Actual result: -------------- 1205022665: Array ( [0] => 5 [1] => 31 [2] => 0 [3] => 9 [4] => 2 [5] => 108 [6] => 0 [7] => 68 [8] => 0 ) +0000 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44380&edit=1