forget to call tzset(3) when php starts
| Bug #27175 | forget to call tzset(3) when php starts | ||||
|---|---|---|---|---|---|
| Submitted: | 2004-02-07 06:20 UTC | Modified: | 2004-02-08 22:59 UTC | ||
| From: | sagawa at sohgoh dot net | Assigned: | |||
| Status: | Closed | Package: | Date/time related | ||
| PHP Version: | 4.3.5RC2 | OS: | CYGWIN_NT-5.1 1.5.7 | ||
| Private report: | No | CVE-ID: | None | ||
[2004-02-07 06:20 UTC] sagawa at sohgoh dot net
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)
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-02-07 22:51 UTC] sagawa at sohgoh dot net
[2004-02-08 22:59 UTC] iliaa@php.net