Bug #52668 [Asn->Csd]: Iterating over a dateperiod twice is broken
| From: | derick@php.net | Date: | Mon, 30 Aug 2010 15:32:16 +0000 |
| Subject: | Bug #52668 [Asn->Csd]: Iterating over a dateperiod twice is broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153928@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52668&edit=1
ID: 52668
Updated by: derick@php.net
Reported by: bugs dot php dot net at muh-die-kuh dot de
Summary: Iterating over a dateperiod twice is broken
-Status: Assigned
+Status: Closed
Type: Bug
Package: Date/time related
PHP Version: 5.3.3
Assigned To: derick
Block user comment: N
New Comment:
This bug has been fixed in SVN.
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:
------------------------------------------------------------------------
[2010-08-30 17:32:11] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&revision=302887
Log: - Fixed bug #52668 (Iterating over a dateperiod twice is broken).
------------------------------------------------------------------------
[2010-08-28 16:24:18] derick@php.net
Another example at: http://php.codepad.org/vjXDqjc1
------------------------------------------------------------------------
[2010-08-22 16:24:48] bugs dot php dot net at muh-die-kuh dot de
Description:
------------
Iterating over a dateperiod twice does not "reset" the iterator,
but starts the second iteration at the endate.
This is kindof an duplicate of #46874, but Derick asked me to add it
anyways.
Test script:
---------------
<?php
$start = new DateTime('20101212');
$interval = DateInterval::createFromDateString('next day');
$dp = new DatePeriod($start, $interval, 0);
foreach($dp as $dt) {
echo $dt->format('r') . "\n"; // Sun, 12 Dec 2010 00:00:00 +0100
}
foreach($dp as $dt) {
echo $dt->format('r') . "\n"; // Mon, 13 Dec 2010 00:00:00 +0100
}
Expected result:
----------------
Sun, 12 Dec 2010 00:00:00 +0100
Sun, 12 Dec 2010 00:00:00 +0100
Actual result:
--------------
Sun, 12 Dec 2010 00:00:00 +0100
Mon, 13 Dec 2010 00:00:00 +0100
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52668&edit=1