File size: 1,234 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--TEST--
DateTime uninitialised exceptions
--INI--
date.timezone=Europe/London
--FILE--
<?php
class MyDatePeriod extends DatePeriod
{
	function __construct()
	{
	}
}

function check(callable $c)
{
	try {
		var_dump($c());
	} catch (\DateObjectError $e) {
		echo $e::class, ': ', $e->getMessage(), "\n";
	}
}

$mdp = new MyDatePeriod();

check(fn() => serialize($mdp));
check(fn() => $mdp->getStartDate());
check(fn() => $mdp->getDateInterval());

check(function() use ($mdp) {
	foreach($mdp as $foo)
	{
	}
});

/* Allowed to be empty */
check(fn() => $mdp->getEndDate());
check(fn() => $mdp->getRecurrences());
?>
--EXPECTF--
DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor
DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor
DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor
DateObjectError: Object of type DatePeriod has not been correctly initialized by calling parent::__construct() in its constructor
NULL
NULL