ID:               46874
 Updated by:       der...@php.net
 Reported By:      php at michaelcrumley dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: WIN32
 PHP Version:      5.3.0alpha3
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.


Previous Comments:
------------------------------------------------------------------------

[2008-12-15 20:55:18] php at michaelcrumley dot com

Description:
------------
After looping through a DatePeriod object, the current date is not
reset so looping again starts at the same date. Maybe that is the
intended behavior, but I would expect it to start at the same date each
time.


Reproduce code:
---------------
$dp = new DatePeriod('R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M');

foreach ($dp as $date) {
    echo $date->format("Y-m-d H:i:s\n");
}

echo "\n";

// this should repeat the same range
foreach ($dp as $date) {
    echo $date->format("Y-m-d H:i:s\n");
}


Expected result:
----------------
2008-03-01 13:00:00
2009-05-11 15:30:00
2010-07-21 18:00:00
2011-10-01 20:30:00
2012-12-11 23:00:00
2014-02-22 01:30:00

2008-03-01 13:00:00
2009-05-11 15:30:00
2010-07-21 18:00:00
2011-10-01 20:30:00
2012-12-11 23:00:00
2014-02-22 01:30:00


Actual result:
--------------
2008-03-01 13:00:00
2009-05-11 15:30:00
2010-07-21 18:00:00
2011-10-01 20:30:00
2012-12-11 23:00:00
2014-02-22 01:30:00

2015-05-02 04:00:00
2016-07-12 06:30:00
2017-09-22 09:00:00
2018-12-02 11:30:00
2020-02-12 14:00:00
2021-04-22 16:30:00



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46874&edit=1

Reply via email to