xref: /PHP-5.5/ext/date/tests/bug46874.phpt (revision 8defb900)
1--TEST--
2Bug #46874 (DatePeriod not resetting after foreach loop)
3--FILE--
4<?php
5$dp = new DatePeriod('R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M');
6
7foreach ($dp as $date) {
8    echo $date->format("Y-m-d H:i:s\n");
9}
10
11echo "\n";
12
13// this should repeat the same range
14foreach ($dp as $date) {
15    echo $date->format("Y-m-d H:i:s\n");
16}
17?>
18--EXPECT--
192008-03-01 13:00:00
202009-05-11 15:30:00
212010-07-21 18:00:00
222011-10-01 20:30:00
232012-12-11 23:00:00
242014-02-22 01:30:00
25
262008-03-01 13:00:00
272009-05-11 15:30:00
282010-07-21 18:00:00
292011-10-01 20:30:00
302012-12-11 23:00:00
312014-02-22 01:30:00
32