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
14class MyDateTimeZone extends DateTimeZone
15{
16	function __construct()
17	{
18	}
19}
20
21function check(callable $c)
22{
23	try {
24		var_dump($c());
25	} catch (\DateObjectError $e) {
26		echo $e::class, ': ', $e->getMessage(), "\n";
27	}
28}
29
30$mdt = new MyDateTime();
31$mdtz = new MyDateTimeZone();
32$dtz = new DateTimeZone("Europe/Kyiv");
33$dt = new DateTime("2023-01-16 18:18");
34
35check(fn() => serialize($mdtz));
36check(fn() => timezone_name_get($mdtz));
37check(fn() => $mdtz->getName());
38check(fn() => timezone_offset_get($mdtz, $dt));
39check(fn() => $mdtz->getOffset($dt));
40check(fn() => timezone_offset_get($dtz, $mdt));
41check(fn() => $dtz->getOffset($mdt));
42check(fn() => timezone_transitions_get($mdtz, time()));
43check(fn() => $mdtz->getTransitions(time()));
44check(fn() => timezone_location_get($mdtz,));
45check(fn() => $mdtz->getLocation());
46?>
47--EXPECTF--
48DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
49DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
50DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
51DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
52DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
53DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
54DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
55DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
56DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
57DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
58DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor
59