|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61685 putenv('TZ=UTC') doesn't update timezone for localtime()
Submitted: 2012-04-09 21:53 UTC Modified: 2020-01-10 16:15 UTC
From: Assigned: ab (profile)
Status: Closed Package: Calendar related
PHP Version: 5.4.0 OS: Windows
Private report: No CVE-ID: None
 [2012-04-09 21:53 UTC]
Regarding Test: ext/calendar/tests/unixtojd.phpt

Test calls putenv('TZ=UTC') but result of unixtojd(1000000000) is off by -1 day unless TZ=UTC is added to the ENV section.

Test script:
see ext/calendar/tests/unixtojd.phpt

Expected result:

Actual result:


61685 (last revision 2012-04-27 22:26 UTC by
unixtojd.patch.txt (last revision 2012-04-09 21:53 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-09 21:53 UTC]
The following patch has been added/updated:

Patch Name: unixtojd.patch.txt
Revision:   1334008426
 [2012-04-10 04:38 UTC]
-Status: Open +Status: Not a bug
 [2012-04-10 04:38 UTC]
- Date extension
463	     - Setting the timezone with the TZ environment variable is no longer
464	       supported, instead date.timezone and/or date_default_timezone_set()
465	       have to be used.
 [2012-04-27 22:26 UTC]
The following patch has been added/updated:

Patch Name: 61685
Revision:   1335565567
 [2012-04-27 22:27 UTC]
Newest patch fixes test to work around the new behavior of putenv("TZ=UTC") and includes some more info about this problem.

This patch works on 5.3.11 and 5.4.1 on Windows 7 and Gentoo (both x86 and x64).
 [2012-04-27 22:50 UTC]
-Status: Not a bug +Status: Feedback
 [2012-04-27 22:50 UTC]
Laruence, unixtojd is not part of the date extension, so this is a value bug report. The patch looks good, can you make a pull request against 5.3?
 [2012-04-27 23:01 UTC]
Anatolyi, please apply it when you can :)
 [2012-04-27 23:01 UTC]
-Assigned To: +Assigned To: ab
 [2012-04-28 09:48 UTC]
-Status: Feedback +Status: Closed
 [2012-04-28 09:48 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2020-01-10 16:15 UTC]
For the record, this is a special case of bug #79051.  The
original test failure almost certainly occurred on a ZTS build,
where putenv('TZ=UTC') does not work for the *current* process,
because the internally called tzset() does not see the variable
set via SetEnvironmentVariable().
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 06:01:31 2024 UTC