#41599 [Asn->Csd]: setTime() fails after modify() is used
| From: | derick@php.net | Date: | Thu, 17 Jan 2008 20:59:17 +0000 |
| Subject: | #41599 [Asn->Csd]: setTime() fails after modify() is used | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121374@lists.php.net to get a copy of this message | ||
ID: 41599
Updated by: derick@php.net
Reported By: kgrecki at gmail dot com
-Status: Assigned
+Status: Closed
Bug Type: Date/time related
Operating System: Windows/Linux
PHP Version: 5.2.3
Assigned To: derick
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2007-06-05 16:11:45] kgrecki at gmail dot com
Description:
------------
setTime() causes time to move to next Sunday if modify() was called
before it. See example. Looks related to Bug #39782
Tested on 5.2.2 Windows & 5.2.3 Linux
Reproduce code:
---------------
date_default_timezone_set('Europe/London');
$start = new DateTime('last Monday');
echo $start->format('Y-m-d H:i:s'),PHP_EOL;
//good
$start->modify('Tuesday');
echo $start->format('Y-m-d H:i:s'),PHP_EOL;
//good
$start->setTime(0, 0, 0);
echo $start->format('Y-m-d H:i:s'),PHP_EOL;
//jumped to next Sunday
$start->setTime(0, 0, 0);
echo $start->format('Y-m-d H:i:s'),PHP_EOL;
//jumped to next Sunday again
Expected result:
----------------
2007-06-04 00:00:00
2007-06-05 00:00:00
2007-06-05 00:00:00
2007-06-05 00:00:00
Actual result:
--------------
2007-06-04 00:00:00
2007-06-05 00:00:00
2007-06-10 00:00:00
2007-06-17 00:00:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41599&edit=1