php-src/ext/date/tests/bug78751.phpt
Christoph M. Becker 89c327f884 Fix #78751: Serialising DatePeriod converts DateTimeImmutable
When getting the properties of a DatePeriod instance we have to retain
the proper classes, and when restoring a DatePeriod instance we have to
cater to DateTimeImmutable instances as well.
2019-10-28 13:07:28 +01:00

17 lines
450 B
PHP

--TEST--
Bug #78751 (Serialising DatePeriod converts DateTimeImmutable)
--FILE--
<?php
$oDay = new DateTimeImmutable('2019-10-25');
$oDateInterval = DateInterval::createFromDateString('1 day');
$oDays = new DatePeriod($oDay, $oDateInterval, $oDay->modify('+1 day'));
$oDays = unserialize(serialize($oDays));
var_dump(
$oDays->start instanceof DateTimeImmutable,
$oDays->end instanceof DateTimeImmutable
);
?>
--EXPECT--
bool(true)
bool(true)