Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #46874 (DatePeriod not resetting after foreach loop) --FILE-- <?php $dp = new..

Decoded Output download

--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
");
}

echo "
";

// this should repeat the same range
foreach ($dp as $date) {
    echo $date->format("Y-m-d H:i:s
");
}
?>
--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

Did this file decode correctly?

Original Code

--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

Function Calls

None

Variables

None

Stats

MD5 c78c7015ed769def5a0bc6d9698cdc27
Eval Count 0
Decode Time 92 ms