forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Derick Rethans
committed
Dec 6, 2011
1 parent
8889fca
commit 5087b0e
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-- |