From: sagawa at sohgoh dot net Operating system: CYGWIN_NT-5.1 1.5.7 PHP version: 4.3.5RC2 PHP Bug Type: Date/time related Bug description: call tzset(3) beginning of PHP exection
Description: ------------ php_localtime_r(almost localtime_r(3)) does not call tzset(3) in some libc (eg. Cygwin, NetBSD). Thus we need call tzset(3) before calling php_localtime_r. http://bugs.php.net/bug.php?id=4732 If we set TZ env. via putenv PHP function, tzset(3) is called internally. But lack of calling tzset(3) before PHP script execution, and some functions. Therefore I get incorect result from php_localtime_r. php_localtime_r is used in these files. ext/calendar/cal_unix.c ext/calendar/easter.c ext/dbase/dbf_misc.c ext/standard/datetime.c ext/standard/info.c main/main.c Reproduce code: --------------- % cat tztest.php <?php /* date() is just example, shows incorrectly */ echo date("r (T)"),"\n"; /* works fine.. because putenv("TZ=JST-9") calls tzset */ putenv("TZ=JST-9"); echo date("r (T)"),"\n"; ?> % TZ="JST-9" php -q tztest.php Expected result: ---------------- Sat, 7 Feb 2004 20:18:15 +0900 (JST) Sat, 7 Feb 2004 20:18:15 +0900 (JST) Actual result: -------------- Sat, 7 Feb 2004 11:18:15 +0000 () Sat, 7 Feb 2004 20:18:15 +0900 (JST) -- Edit bug report at http://bugs.php.net/?id=27175&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27175&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27175&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27175&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27175&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27175&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27175&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27175&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27175&r=support Expected behavior: http://bugs.php.net/fix.php?id=27175&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27175&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27175&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27175&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27175&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27175&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27175&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27175&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27175&r=float