ID: 41599
Updated by: [EMAIL PROTECTED]
Reported By: kgrecki at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: Windows/Linux
PHP Version: 5.2.3
-Assigned To:
+Assigned To: derick
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