derick                                   Mon, 30 Aug 2010 15:35:41 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=302888

Log:
- Added test for bug #46874 (same as #52668).

Bugs: http://bugs.php.net/46874 (Bogus) DatePeriod not resetting after foreach 
loop
      http://bugs.php.net/52668 (Closed) Iterating over a dateperiod twice is 
broken
      
Changed paths:
    A   php/php-src/branches/PHP_5_3/ext/date/tests/bug46874.phpt
    A   php/php-src/trunk/ext/date/tests/bug46874.phpt

Added: php/php-src/branches/PHP_5_3/ext/date/tests/bug46874.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/bug46874.phpt                   
        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/bug46874.phpt   2010-08-30 
15:35:41 UTC (rev 302888)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #46874 (DatePeriod not resetting after foreach loop)
+--FILE--
+<?php
+$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");
+}
+?>
+--EXPECT--
+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

Added: php/php-src/trunk/ext/date/tests/bug46874.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug46874.phpt                              
(rev 0)
+++ php/php-src/trunk/ext/date/tests/bug46874.phpt      2010-08-30 15:35:41 UTC 
(rev 302888)
@@ -0,0 +1,31 @@
+--TEST--
+Bug #46874 (DatePeriod not resetting after foreach loop)
+--FILE--
+<?php
+$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");
+}
+?>
+--EXPECT--
+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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to