xref: /PHP-7.0/ext/date/tests/bug48476.phpt (revision 109cc0bf)
1--TEST--
2Bug #48476 (cloning extended DateTime class without calling parent::__constr crashed PHP)
3--FILE--
4<?php
5class MyDateTime extends DateTime {
6	public function __construct() { }
7}
8class MyDateTimeZone extends DateTimeZone {
9	public function __construct() { }
10}
11
12$o = new MyDateTime;
13var_dump($o->format("d"));
14$x = clone $o;
15
16var_dump($x->format("d"));
17
18clone $o;
19
20
21var_dump(timezone_location_get(clone new MyDateTimezone));
22?>
23--EXPECTF--
24Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10
25bool(false)
26
27Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13
28bool(false)
29
30Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18
31bool(false)
32
33
34