Date bug??
| From: | Jay D. Mumper | Date: | Fri, 29 Sep 2000 20:41:23 +0000 |
| Subject: | Date bug?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18115@lists.php.net to get a copy of this message | ||
Hey folks-
Could someone please try this code on a Linux/Apache 1.3.12/PHP4.0.2
box for me? I get the results shown below - quite strange. To
make matters worse, I can reload the page 20 times and get correct
results, only to have the next 20 return the incorrect results.
My logs have no errors reported. No threads appear to be dying.
And the code runs find on PHP3 -- Is this a real bug?
I know the code that saves the $oldTZ is unnecessary, I just was
trying to see if reading the TZ out of the environment changed
anything -- it doesn't.
Here's the script:
<?
$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");
?>
Incorrect results:
A: TZ= :America/New_York: GMTOFFSET = 0
B: TZ= :America/New_York: GMTOFFSET = 0
A: TZ= :America/New_York: GMTOFFSET = -14400
B: TZ= :America/New_York: GMTOFFSET = -14400
Correct results:
A: TZ= :America/New_York: GMTOFFSET = -14400
B: TZ= :America/New_York: GMTOFFSET = -14400
A: TZ= :America/New_York: GMTOFFSET = -14400
B: TZ= :America/New_York: GMTOFFSET = -14400
--
Jay Mumper
Consultant / Anteil, Inc.
http://www.anteil.com