ID: 25825 Updated by: [EMAIL PROTECTED] Reported By: pennington at rhodes dot edu -Status: Assigned +Status: Closed Bug Type: Date/time related Operating System: Windows 2000 PHP Version: 4.3.3 Assigned To: wez New Comment:
This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. The problem was that putenv("TZ=...") would call tzset() in order to update the libc with the timezone information for the time related functions, but PHP would not call tzset() again when the environment was reset. I've checked in a fix for this problem, which should hopefully make things better. However, a word of warning: The environmental variables are process-wide, so changing them in a threaded environment like ISAPI may cause some gotchas in high-concurrency scenarios (eg: two threads might be playing with the same env var at the same time). I'm marking this report as closed as the next snapshots will contain the fix. If the problem is still present in those, please reopen this report. Previous Comments: ------------------------------------------------------------------------ [2003-10-14 18:37:33] [EMAIL PROTECTED] Yes; that is what is happening. I'll look into having PHP reset to the system default locale at the start of each request. ------------------------------------------------------------------------ [2003-10-14 14:22:09] pennington at rhodes dot edu Ahh, the TikiWiki PHP application (in /lib/date/TimeZone.php) that we are running does use putenv() in the following function: ---------------- /** * Is the given date/time in DST for this time zone * * Attempts to determine if a given Date object represents a date/time * that is in DST for this time zone. WARNINGS: this basically attempts to * "trick" the system into telling us if we're in DST for a given time zone. * This uses putenv() which may not work in safe mode, and relies on unix time * which is only valid for dates from 1970 to ~2038. This relies on the * underlying OS calls, so it may not work on Windows or on a system where * zoneinfo is not installed or configured properly. * * @access public * @param object Date $date the date/time to test * @return boolean true if this date is in DST for this time zone */ function inDaylightTime($date) { $env_tz = ""; if(getenv("TZ")) { $env_tz = getenv("TZ"); } putenv("TZ=".$this->id); $ltime = localtime($date->getTime(), true); putenv("TZ=".$env_tz); return $ltime['tm_isdst']; } ------------------- Are you saying that this could change the environment variable for timezone for the entire server for good (at least until IIS5 is restarted) once this code is executed? And this would affect pages that don't even include the function above? ------------------------------------------------------------------------ [2003-10-14 12:15:49] [EMAIL PROTECTED] The only other way to manipulate locale is via putenv(), which would change LC_* environment variable. ------------------------------------------------------------------------ [2003-10-14 10:29:48] pennington at rhodes dot edu I searched through all of the PHP code in use on this machine for the setlocale() function and only found two entries, both of which were commented out. The only ISAPI filter we are using is PHP, and there is no ASP or other code on that machine. In other words, we are only using it to serve PHP pages, and none of those scripts use setlocale(). Would it be wise to unload the ASP stuff from the app mappings in IIS5 if we aren't using it so we can test to rule out ASP as the problem? Are there any other PHP functions (other than setlocale) that manipulate the locale? ------------------------------------------------------------------------ [2003-10-13 18:41:27] [EMAIL PROTECTED] Do any of your scripts use setlocale() or other similar function to manipulate the locale? My gut feeling is that something is (and it might be ASP or some other ISAPI you have there), and that it isn't being reset back to the system default. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/25825 -- Edit this bug report at http://bugs.php.net/?id=25825&edit=1