php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8609 putenv failing with TZ
Submitted: 2001-01-09 03:29 UTC Modified: 2001-01-09 04:05 UTC
From: seth at northrops dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.4 OS: Linux/FreeBSD
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: seth at northrops dot com
New email:
PHP Version: OS:

 

 [2001-01-09 03:29 UTC] seth at northrops dot com
I noticed that there are still issues with switching between
timezones. 

For example, given the following:

<?

  # foo.php
  putenv("TZ=Greenwich");
  echo date("H")."\n";
  putenv("TZ=US/Central");
  echo date("H")."\n";
  putenv("TZ=Greenwich");
  echo date("H")."\n";

?>


$./php3 foo.php 
Content-type: text/html

03
21
03


$./php4 foo.php 
X-Powered-By: PHP/4.0.1pl2
Content-type: text/html

03
03
03


$./php4.4 foo.php
X-Powered-By: PHP/4.0.4
Content-type: text/html

03
03
03

Notice it worked in php3, but is failing within PHP 4 (including 4.0.4).  Also notice that the first switch usually works; though, I've even noticed where the first putenv fails and the script stays within the local timezone.

I also noticed there has been previous discussion (but no response?) on the topic:

http://marc.theaimsgroup.com/?l=php-general&m=97666005518422&w=2
http://marc.theaimsgroup.com/?l=php-general&m=97157283226980&w=2

Finally, it APPEARS that calling mktime after the putenv in 4.0.x seems to cause the putenv to work.  (ie, it seems to activate the TZ change).  Absent a mktime, it stays in the local timezone.  

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-09 04:05 UTC] sniper@php.net
Fixed in CVS.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC