Re: Date bug??

From: Date: Fri, 29 Sep 2000 08:59:25 +0000
Subject: Re: Date bug??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-18116@lists.php.net to get a copy of this message
Believe it or not but if you switch the following: $oldTZ = getenv("TZ"); putenv("TZ=$TZ"); to putenv("TZ=$TZ"); $oldTZ = getenv("TZ"); it works every time for me????????????? This is funny??????????? Jay ----- Original Message ----- From: "Jay D. Mumper" <jdm@anteil.com> To: "PHP List" <php-general@lists.php.net> Sent: Friday, September 29, 2000 4:41 PM Subject: [PHP] Date bug?? > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#18116) next »