cvs: php-src /ext/date php_date.c /ext/date/tests bug39782.phpt

From: Date: Mon, 11 Dec 2006 21:08:45 +0000
Subject: cvs: php-src /ext/date php_date.c /ext/date/tests bug39782.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42056@lists.php.net to get a copy of this message
iliaa Mon Dec 11 21:08:45 2006 UTC Modified files: /php-src/ext/date/tests bug39782.phpt /php-src/ext/date php_date.c Log: MFB: Fixed bug #39782 (setTime() on a DateTime constructed with a Weekday yields incorrect results). http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug39782.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/date/tests/bug39782.phpt diff -u /dev/null php-src/ext/date/tests/bug39782.phpt:1.2 --- /dev/null Mon Dec 11 21:08:45 2006 +++ php-src/ext/date/tests/bug39782.phpt Mon Dec 11 21:08:44 2006 @@ -0,0 +1,19 @@ +--TEST-- +Bug #39782 (setTime() on a DateTime constructed with a Weekday yields incorrect results) +--FILE-- +<?php +date_default_timezone_set("GMT"); + +$dttTest = new DateTime('Dec 10 2006 Next Wednesday'); +echo $dttTest->format('D M j Y - H:i:s') . "\n"; + +$dttTest->setTime(12, 0, 0); +echo $dttTest->format('D M j Y - H:i:s') . "\n"; + +$dttTest->setTime(12, 0, 0); +echo $dttTest->format('D M j Y - H:i:s') . "\n"; +?> +--EXPECT-- +Wed Dec 13 2006 - 00:00:00 +Wed Dec 13 2006 - 12:00:00 +Wed Dec 13 2006 - 12:00:00 \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.125&r2=1.126&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.125 php-src/ext/date/php_date.c:1.126 --- php-src/ext/date/php_date.c:1.125 Mon Nov 6 16:10:33 2006 +++ php-src/ext/date/php_date.c Mon Dec 11 21:08:44 2006 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_date.c,v 1.125 2006/11/06 16:10:33 bjori Exp $ */ +/* $Id: php_date.c,v 1.126 2006/12/11 21:08:44 iliaa Exp $ */ #include "php.h" #include "php_streams.h" @@ -1771,6 +1771,7 @@ timelib_fill_holes(dateobj->time, now, 0); timelib_update_ts(dateobj->time, tzi); + dateobj->time->have_weekday_relative = dateobj->time->have_relative = 0; if (now->tz_info != tzi) { timelib_tzinfo_dtor(now->tz_info); }

« previous php.cvs (#42056) next »