1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/date/tests/DateTimeImmutable_inherited_serialization.phpt

24 lines
527 B
PHP

--TEST--
Inherited DateTimeImmutable serialisation with custom properties
--FILE--
<?php
date_default_timezone_set("Europe/London");
class MyDateTimeImmutable extends DateTimeImmutable
{
public function __construct(
string $datetime = "now",
?DateTimeZone $timezone = null,
public ?bool $myProperty = null,
) {
parent::__construct($datetime, $timezone);
}
}
$d = new MyDateTimeImmutable("2023-01-25 16:32:55", myProperty: true);
$e = unserialize(serialize($d));
var_dump($e->myProperty);
?>
--EXPECTF--
bool(true)