php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6972 date("Z") fails after putenv("TZ=<val>"), works with a getenv("TZ") between
Submitted: 2000-10-02 02:14 UTC Modified: 2001-01-09 04:08 UTC
From: jdm at anteil dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.2 OS: Linux (RH6.2)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
37 - 2 = ?
Subscribe to this entry?

 
 [2000-10-02 02:14 UTC] jdm at anteil dot com
Script to produce the problem:
<?
 
 $TZ=":America/New_York";
 
 $oldTZ = getenv("TZ");
 putenv("TZ=$TZ");
 
 $y = date("Z");
 $x = date("Z");
 
 echo "A: TZ= $TZ: GMTOFFSET = $y <BR>";
 echo "B: TZ= $TZ: GMTOFFSET = $x <BR>";
 putenv("TZ=$oldTZ");
 
 $oldTZ = getenv("TZ");
 putenv("TZ=$TZ");
 
 $y = date("Z");
 $x = date("Z");
 
 echo "A: TZ= $TZ: GMTOFFSET = $y <BR>";
 echo "B: TZ= $TZ: GMTOFFSET = $x <BR>";
 putenv("TZ=$oldTZ");
 
?>

If you swap the lines (at the top of the script):
 $oldTZ = getenv("TZ");
 putenv("TZ=$TZ");
to:
 putenv("TZ=$TZ");
 $oldTZ = getenv("TZ");
the script works fine.

My installation is RH6.2/apache 1.3.12/php4.0.2/mysql 3.22.23.  I also have a 
database logging and replication layer as a module in php, but I had someone
on the PHP GENERAL mailing list verify the bug on their setup.  This appears 
to be a glitch in environment memory handling, but I can't be sure.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-09 04:08 UTC] sniper@php.net
This is fixed in CVS now.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC