File size: 942 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 | --TEST--
DateTimeImmutable::createFromInterface exception
--INI--
date.timezone=Europe/London
--FILE--
<?php
class MyDateTime extends DateTime
{
function __construct()
{
}
}
class MyDateTimeImmutable extends DateTimeImmutable
{
function __construct()
{
}
}
$i = new MyDateTime();
try {
$m = DateTimeImmutable::createFromInterface( $i );
} catch (\DateObjectError $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
$i = new MyDateTimeImmutable();
try {
$m = DateTimeImmutable::createFromInterface( $i );
} catch (\DateObjectError $e) {
echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor
DateObjectError: Object of type MyDateTimeImmutable (inheriting DateTimeImmutable) has not been correctly initialized by calling parent::__construct() in its constructor
|