1--TEST-- 2Inherited DateTimeImmutable serialisation with custom properties 3--FILE-- 4<?php 5date_default_timezone_set("Europe/London"); 6 7class MyDateTimeImmutable extends DateTimeImmutable 8{ 9 public function __construct( 10 string $datetime = "now", 11 ?DateTimeZone $timezone = null, 12 public ?bool $myProperty = null, 13 ) { 14 parent::__construct($datetime, $timezone); 15 } 16} 17 18$d = new MyDateTimeImmutable("2023-01-25 16:32:55", myProperty: true); 19$e = unserialize(serialize($d)); 20var_dump($e->myProperty); 21?> 22--EXPECTF-- 23bool(true) 24