Skip to content

Commit

Permalink
- Added a test case for #53437.
Browse files Browse the repository at this point in the history
  • Loading branch information
Derick Rethans committed Dec 6, 2011
1 parent 8889fca commit 5087b0e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions ext/date/tests/bug53437.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
Bug #53437: Crash when using unserialized DatePeriod instance
--XFAIL--
Bug #53437 Not fixed yet
--FILE--
<?php
$dp = new DatePeriod(new DateTime('2010-01-01 UTC'), new DateInterval('P1D'), 2);

echo "Original:\r\n";
foreach($dp as $dt) {
echo $dt->format('Y-m-d H:i:s')."\r\n";
}
echo "\r\n";
var_dump($dp);

$ser = serialize($dp); // $ser is: O:10:"DatePeriod":0:{}

// Create dangerous instance
$dpu = unserialize($ser); // $dpu has invalid values???
var_dump($dpu);

echo "Unserialized:\r\n";
// ???which leads to CRASH:
foreach($dpu as $dt) {
echo $dt->format('Y-m-d H:i:s')."\r\n";
}
?>
--EXPECT--

0 comments on commit 5087b0e

Please sign in to comment.