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
Showing
5 changed files
with
251 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,13 @@ | ||
--TEST-- | ||
Bug #53437 (Crash when using unserialized DatePeriod instance), variation 2 | ||
--FILE-- | ||
<?php | ||
$s = 'O:10:"DatePeriod":0:{}'; | ||
|
||
$dp = unserialize($s); | ||
|
||
var_dump($dp); | ||
?> | ||
==DONE== | ||
--EXPECTF-- | ||
Fatal error: Invalid serialization data for DatePeriod object in %sbug53437_var1.php on line %d |
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,80 @@ | ||
--TEST-- | ||
Bug #53437 DateInterval basic serialization | ||
--FILE-- | ||
<?php | ||
$di0 = new DateInterval('P2Y4DT6H8M'); | ||
|
||
$s = serialize($di0); | ||
|
||
$di1 = unserialize($s); | ||
|
||
var_dump($di0, $di1); | ||
|
||
?> | ||
==DONE== | ||
--EXPECT-- | ||
object(DateInterval)#1 (15) { | ||
["y"]=> | ||
int(2) | ||
["m"]=> | ||
int(0) | ||
["d"]=> | ||
int(4) | ||
["h"]=> | ||
int(6) | ||
["i"]=> | ||
int(8) | ||
["s"]=> | ||
int(0) | ||
["weekday"]=> | ||
int(0) | ||
["weekday_behavior"]=> | ||
int(0) | ||
["first_last_day_of"]=> | ||
int(0) | ||
["invert"]=> | ||
int(0) | ||
["days"]=> | ||
bool(false) | ||
["special_type"]=> | ||
int(0) | ||
["special_amount"]=> | ||
int(0) | ||
["have_weekday_relative"]=> | ||
int(0) | ||
["have_special_relative"]=> | ||
int(0) | ||
} | ||
object(DateInterval)#2 (15) { | ||
["y"]=> | ||
int(2) | ||
["m"]=> | ||
int(0) | ||
["d"]=> | ||
int(4) | ||
["h"]=> | ||
int(6) | ||
["i"]=> | ||
int(8) | ||
["s"]=> | ||
int(0) | ||
["weekday"]=> | ||
int(0) | ||
["weekday_behavior"]=> | ||
int(0) | ||
["first_last_day_of"]=> | ||
int(0) | ||
["invert"]=> | ||
int(0) | ||
["days"]=> | ||
int(0) | ||
["special_type"]=> | ||
int(0) | ||
["special_amount"]=> | ||
int(0) | ||
["have_weekday_relative"]=> | ||
int(0) | ||
["have_special_relative"]=> | ||
int(0) | ||
} | ||
==DONE== |
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,47 @@ | ||
--TEST-- | ||
Bug #53437 DateInterval unserialize bad data, 32 bit | ||
--SKIPIF-- | ||
<?php if (PHP_INT_SIZE != 4) { die('skip 32 bit only'); } ?> | ||
--FILE-- | ||
<?php | ||
$s = 'O:12:"DateInterval":15:{s:1:"y";s:1:"2";s:1:"m";s:1:"0";s:1:"d";s:3:"bla";s:1:"h";s:1:"6";s:1:"i";s:1:"8";s:1:"s";s:1:"0";s:7:"weekday";i:10;s:16:"weekday_behavior";i:10;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";s:4:"aoeu";s:12:"special_type";i:0;s:14:"special_amount";s:21:"234523452345234532455";s:21:"have_weekday_relative";i:21474836489;s:21:"have_special_relative";s:3:"bla";}'; | ||
|
||
$di = unserialize($s); | ||
var_dump($di); | ||
|
||
?> | ||
==DONE== | ||
--EXPECT-- | ||
object(DateInterval)#1 (15) { | ||
["y"]=> | ||
int(2) | ||
["m"]=> | ||
int(0) | ||
["d"]=> | ||
int(0) | ||
["h"]=> | ||
int(6) | ||
["i"]=> | ||
int(8) | ||
["s"]=> | ||
int(0) | ||
["weekday"]=> | ||
int(10) | ||
["weekday_behavior"]=> | ||
int(10) | ||
["first_last_day_of"]=> | ||
int(0) | ||
["invert"]=> | ||
int(0) | ||
["days"]=> | ||
int(0) | ||
["special_type"]=> | ||
int(0) | ||
["special_amount"]=> | ||
int(-1) | ||
["have_weekday_relative"]=> | ||
int(9) | ||
["have_special_relative"]=> | ||
int(0) | ||
} | ||
==DONE== |
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,64 @@ | ||
--TEST-- | ||
Bug #53437 (Check that var_dump out is the same using the whole object or it's single properties), variation 4 | ||
--INI-- | ||
date.timezone = Europe/Berlin | ||
--FILE-- | ||
<?php | ||
$dt = new DateTime('2009-10-11'); | ||
|
||
$df = $dt->diff(new DateTime('2009-10-13')); | ||
|
||
var_dump($df, | ||
$df->y, | ||
$df->m, | ||
$df->d, | ||
$df->h, | ||
$df->i, | ||
$df->s, | ||
$df->invert, | ||
$df->days); | ||
|
||
?> | ||
==DONE== | ||
--EXPECTF-- | ||
object(DateInterval)#%d (15) { | ||
["y"]=> | ||
int(0) | ||
["m"]=> | ||
int(0) | ||
["d"]=> | ||
int(2) | ||
["h"]=> | ||
int(0) | ||
["i"]=> | ||
int(0) | ||
["s"]=> | ||
int(0) | ||
["weekday"]=> | ||
int(0) | ||
["weekday_behavior"]=> | ||
int(0) | ||
["first_last_day_of"]=> | ||
int(0) | ||
["invert"]=> | ||
int(0) | ||
["days"]=> | ||
int(2) | ||
["special_type"]=> | ||
int(0) | ||
["special_amount"]=> | ||
int(0) | ||
["have_weekday_relative"]=> | ||
int(0) | ||
["have_special_relative"]=> | ||
int(0) | ||
} | ||
int(0) | ||
int(0) | ||
int(2) | ||
int(0) | ||
int(0) | ||
int(0) | ||
int(0) | ||
int(2) | ||
==DONE== |
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,47 @@ | ||
--TEST-- | ||
Bug #53437 DateInterval unserialize bad data, 64 bit | ||
--SKIPIF-- | ||
<?php if (PHP_INT_SIZE != 8) { die('skip true 64 bit only'); } ?> | ||
--FILE-- | ||
<?php | ||
$s = 'O:12:"DateInterval":15:{s:1:"y";s:1:"2";s:1:"m";s:1:"0";s:1:"d";s:3:"bla";s:1:"h";s:1:"6";s:1:"i";s:1:"8";s:1:"s";s:1:"0";s:7:"weekday";i:10;s:16:"weekday_behavior";i:10;s:17:"first_last_day_of";i:0;s:6:"invert";i:0;s:4:"days";s:4:"aoeu";s:12:"special_type";i:0;s:14:"special_amount";s:21:"234523452345234532455";s:21:"have_weekday_relative";i:21474836489;s:21:"have_special_relative";s:3:"bla";}'; | ||
|
||
$di = unserialize($s); | ||
var_dump($di); | ||
|
||
?> | ||
==DONE== | ||
--EXPECT-- | ||
object(DateInterval)#1 (15) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
["y"]=> | ||
int(2) | ||
["m"]=> | ||
int(0) | ||
["d"]=> | ||
int(0) | ||
["h"]=> | ||
int(6) | ||
["i"]=> | ||
int(8) | ||
["s"]=> | ||
int(0) | ||
["weekday"]=> | ||
int(10) | ||
["weekday_behavior"]=> | ||
int(10) | ||
["first_last_day_of"]=> | ||
int(0) | ||
["invert"]=> | ||
int(0) | ||
["days"]=> | ||
int(0) | ||
["special_type"]=> | ||
int(0) | ||
["special_amount"]=> | ||
int(9223372036854775807) | ||
["have_weekday_relative"]=> | ||
int(9) | ||
["have_special_relative"]=> | ||
int(0) | ||
} | ||
==DONE== |
trivial one #1 -> #%d here :)