/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
ext/date/tests/bug48476.phpt
37 строк
1 KB
Derick Rethans
Implement More Appropriate Date/Time Exceptions RFC
08 фев 2023, 13:27
08 фев 2023, 13:27
b7860cd
Код
Авторство
О чём код?
--TEST-- Bug #48476 (cloning extended DateTime class without calling parent::__constr crashed PHP) --FILE-- <?php class MyDateTime extends DateTime { public function __construct() { } } class MyDateTimeZone extends DateTimeZone { public function __construct() { } } $o = new MyDateTime; try { var_dump($o->format("d")); } catch (Error $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } $x = clone $o; try { var_dump($x->format("d")); } catch (Error $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } clone $o; try { var_dump(timezone_location_get(clone new MyDateTimezone)); } catch (Error $e) { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> --EXPECT-- DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor DateObjectError: Object of type MyDateTime (inheriting DateTime) has not been correctly initialized by calling parent::__construct() in its constructor DateObjectError: Object of type MyDateTimeZone (inheriting DateTimeZone) has not been correctly initialized by calling parent::__construct() in its constructor