1--TEST--
2DateTime uninitialised exceptions
3--INI--
4date.timezone=Europe/London
5--FILE--
6<?php
7class MyDateTime extends DateTime
8{
9	function __construct()
10	{
11	}
12}
13
14function check(callable $c)
15{
16	try {
17		var_dump($c());
18	} catch (\DateObjectError $e) {
19		echo $e::class, ': ', $e->getMessage(), "\n";
20	}
21}
22
23$mdt = new MyDateTime();
24$dt = new DateTime();
25$di = DateInterval::createFromDateString("tomorrow");
26$dtz = new DateTimeZone("Europe/Kyiv");
27
28check(fn() => DateTime::createFromInterface($mdt));
29check(fn() => DateTimeImmutable::createFromMutable($mdt));
30check(fn() => serialize($mdt));
31check(fn() => date_format($mdt, DateTime::ISO8601));
32check(fn() => $mdt->format(DateTime::ISO8601));
33check(fn() => date_modify($mdt, "+1 day"));
34check(fn() => $mdt->modify("+1 day"));
35check(fn() => $mdt->add($di));
36check(fn() => $mdt->sub($di));
37check(fn() => date_timezone_get($mdt));
38check(fn() => $mdt->getTimeZone());
39check(fn() => date_timezone_set($mdt, $dtz));
40check(fn() => $mdt->setTimeZone($dtz));
41check(fn() => date_offset_get($mdt));
42check(fn() => $mdt->getOffset());
43check(fn() => date_time_set($mdt, 17, 59, 53));
44check(fn() => $mdt->setTime(17, 59, 53));
45check(fn() => date_date_set($mdt, 2023, 1, 16));
46check(fn() => $mdt->setDate(2023, 1, 16));
47check(fn() => date_isodate_set($mdt, 2023, 3, 1));
48check(fn() => $mdt->setISODate(2023, 3, 1));
49check(fn() => date_timestamp_set($mdt, time()));
50check(fn() => $mdt->setTimestamp(time()));
51check(fn() => date_timestamp_get($mdt));
52check(fn() => $mdt->getTimestamp());
53check(fn() => date_diff($dt, $mdt));
54check(fn() => date_diff($mdt, $dt));
55check(fn() => date_diff($mdt, $mdt));
56check(fn() => $dt->diff($mdt));
57check(fn() => $mdt->diff($dt));
58check(fn() => $mdt->diff($mdt));
59?>
60--EXPECTF--
61DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
62DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
63DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
64DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
65DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
66DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
67DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
68DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
69DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
70DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
71DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
72DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
73DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
74DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
75DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
76DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
77DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
78DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
79DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
80DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
81DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
82DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
83DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
84DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
85DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
86DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
87DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
88DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
89DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
90DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
91DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
92