Annotation of embedaddon/php/ext/date/tests/bug53437.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #53437 (Crash when using unserialized DatePeriod instance)
! 3: --XFAIL--
! 4: Bug #53437 Not fixed yet
! 5: --FILE--
! 6: <?php
! 7: $dp = new DatePeriod(new DateTime('2010-01-01 UTC'), new DateInterval('P1D'), 2);
! 8:
! 9: echo "Original:\r\n";
! 10: foreach($dp as $dt) {
! 11: echo $dt->format('Y-m-d H:i:s')."\r\n";
! 12: }
! 13: echo "\r\n";
! 14: var_dump($dp);
! 15:
! 16: $ser = serialize($dp); // $ser is: O:10:"DatePeriod":0:{}
! 17:
! 18: // Create dangerous instance
! 19: $dpu = unserialize($ser); // $dpu has invalid values???
! 20: var_dump($dpu);
! 21:
! 22: echo "Unserialized:\r\n";
! 23: // ???which leads to CRASH:
! 24: foreach($dpu as $dt) {
! 25: echo $dt->format('Y-m-d H:i:s')."\r\n";
! 26: }
! 27: ?>
! 28: --EXPECT--
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>