bug46874.phpt 587 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #46874 (DatePeriod not resetting after foreach loop)
  3. --FILE--
  4. <?php
  5. $dp = new DatePeriod('R5/2008-03-01T13:00:00Z/P1Y2M10DT2H30M');
  6. foreach ($dp as $date) {
  7. echo $date->format("Y-m-d H:i:s\n");
  8. }
  9. echo "\n";
  10. // this should repeat the same range
  11. foreach ($dp as $date) {
  12. echo $date->format("Y-m-d H:i:s\n");
  13. }
  14. ?>
  15. --EXPECT--
  16. 2008-03-01 13:00:00
  17. 2009-05-11 15:30:00
  18. 2010-07-21 18:00:00
  19. 2011-10-01 20:30:00
  20. 2012-12-11 23:00:00
  21. 2014-02-22 01:30:00
  22. 2008-03-01 13:00:00
  23. 2009-05-11 15:30:00
  24. 2010-07-21 18:00:00
  25. 2011-10-01 20:30:00
  26. 2012-12-11 23:00:00
  27. 2014-02-22 01:30:00