1--TEST-- 2DateTime uninitialised exceptions 3--INI-- 4date.timezone=Europe/London 5--FILE-- 6<?php 7class MyDatePeriod extends DatePeriod 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$mdp = new MyDatePeriod(); 24 25check(fn() => serialize($mdp)); 26check(fn() => $mdp->getStartDate()); 27check(fn() => $mdp->getDateInterval()); 28 29check(function() use ($mdp) { 30 foreach($mdp as $foo) 31 { 32 } 33}); 34 35/* Allowed to be empty */ 36check(fn() => $mdp->getEndDate()); 37check(fn() => $mdp->getRecurrences()); 38?> 39--EXPECTF-- 40DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor 41DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor 42DateObjectError: Object of type MyDatePeriod (inheriting DatePeriod) has not been correctly initialized by calling parent::__construct() in its constructor 43DateObjectError: Object of type DatePeriod has not been correctly initialized by calling parent::__construct() in its constructor 44NULL 45NULL 46