Re: Fix for php4 bug #30096

From: Date: Mon, 15 Nov 2004 17:24:20 +0000
Subject: Re: Fix for php4 bug #30096
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-13867@lists.php.net to get a copy of this message
But then whole function php_mktime() is wrong, as in case where gm=1, you expect that parameters you pass are GMT, and still you fill defaults with localtime. Also, later, if gm=1, timezone adjustment is in use, but with parameters that are in GMT. So the real good fix would be to remove timezone stuff completly out of there, and make another function in pair with php_localtime_r, that returns GMT, and to use it when gm=1. On Mon, 2004-11-15 at 17:54, Derick Rethans wrote: > On Mon, 15 Nov 2004, Vladimir Zidar wrote: > > > So the fix is easy: > > > > --- ext/standard/datetime.c.orig Fri Nov 12 22:35:04 2004 > > +++ ext/standard/datetime.c Fri Nov 12 22:35:33 2004 > > @@ -256,7 +256,7 @@ > > gmadjust = -(is_dst ? timezone - 3600 : timezone); > > #endif > > #endif > > - seconds += gmadjust; > > + seconds -= gmadjust; > > } > > > > RETURN_LONG(seconds); > > This fix is wrong, the example now returns definitely the wrong answer: > > derick@kossu:/dat/dev/php/php-5.0dev$ cat ext/standard/tests/time/bug30096.php > <?php > echo gmdate("H:i:s Y-m-d", gmmktime(02,00,01, 03,28,2004)); > ?> > > derick@kossu:/dat/dev/php/php-5.0dev$ sapi/cli/php ext/standard/tests/time/bug30096.php > 23:00:01 2004-03-27 > > This bug has nothing to do with the wrong direction of the adjustment, > but more with the chancing to DST at that date. > > regards, > Derick -- Vladimir Zidar, Programmer MindNever Foodstuff TRDG. Head Office Branch Tel: +381-63-550161, +385-98-9574261 http://www.mindnever.org, icq: 15414204, mail: mr_W@mindnever.org

« previous php.internals (#13867) next »