php.net |  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: mattficken@php.net Assigned: ab (profile)
Status: Closed Package: Calendar related
PHP Version: 5.4.0 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mattficken@php.net
New email:
PHP Version: OS:

 

 [2012-04-09 21:53 UTC] mattficken@php.net
Description:
------------
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:
----------------
Pass

Actual result:
--------------
Fail

Patches

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

Add a Patch

Pull Requests

Add a Pull Request

History

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

Patch Name: unixtojd.patch.txt
Revision:   1334008426
URL:        https://bugs.php.net/patch-display.php?bug=61685&patch=unixtojd.patch.txt&revision=1334008426
 [2012-04-10 04:38 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2012-04-10 04:38 UTC] laruence@php.net
- 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.

http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/UPGRADING?view=markup
 [2012-04-27 22:26 UTC] mattficken@php.net
The following patch has been added/updated:

Patch Name: 61685
Revision:   1335565567
URL:        https://bugs.php.net/patch-display.php?bug=61685&patch=61685&revision=1335565567
 [2012-04-27 22:27 UTC] mattficken@php.net
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] derick@php.net
-Status: Not a bug +Status: Feedback
 [2012-04-27 22:50 UTC] derick@php.net
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] pajoye@php.net
Anatolyi, please apply it when you can :)
 [2012-04-27 23:01 UTC] pajoye@php.net
-Assigned To: +Assigned To: ab
 [2012-04-28 09:48 UTC] ab@php.net
-Status: Feedback +Status: Closed
 [2012-04-28 09:48 UTC] ab@php.net
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
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2020-01-10 16:15 UTC] cmb@php.net
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: Sat Apr 20 06:01:28 2024 UTC