1--TEST--
2Test clone of objects whoose class derived from DateTime class
3--FILE--
4<?php
5//Set the default time zone
6date_default_timezone_set("Europe/London");
7
8class DateTimeExt1 extends DateTime {
9	public $property1 = 99;
10	public $property2 = "Hello";
11
12}
13
14class DateTimeExt2 extends DateTimeExt1 {
15	public $property3 = true;
16	public $property4 = 10.5;
17}
18
19echo "*** Testing clone on objects whoose class derived from DateTime class ***\n";
20
21$d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT");
22var_dump($d1);
23$d1_clone = clone $d1;
24var_dump($d1_clone);
25
26$d2 = new DateTimeExt2("2009-02-03 12:34:41 GMT");
27var_dump($d2);
28$d2_clone = clone $d2;
29var_dump($d2_clone);
30?>
31===DONE===
32--EXPECTF--
33*** Testing clone on objects whoose class derived from DateTime class ***
34object(DateTimeExt1)#%d (5) {
35  ["property1"]=>
36  int(99)
37  ["property2"]=>
38  string(5) "Hello"
39  ["date"]=>
40  string(26) "2009-02-03 12:34:41.000000"
41  ["timezone_type"]=>
42  int(2)
43  ["timezone"]=>
44  string(3) "GMT"
45}
46object(DateTimeExt1)#%d (5) {
47  ["property1"]=>
48  int(99)
49  ["property2"]=>
50  string(5) "Hello"
51  ["date"]=>
52  string(26) "2009-02-03 12:34:41.000000"
53  ["timezone_type"]=>
54  int(2)
55  ["timezone"]=>
56  string(3) "GMT"
57}
58object(DateTimeExt2)#%d (7) {
59  ["property3"]=>
60  bool(true)
61  ["property4"]=>
62  float(10.5)
63  ["property1"]=>
64  int(99)
65  ["property2"]=>
66  string(5) "Hello"
67  ["date"]=>
68  string(26) "2009-02-03 12:34:41.000000"
69  ["timezone_type"]=>
70  int(2)
71  ["timezone"]=>
72  string(3) "GMT"
73}
74object(DateTimeExt2)#%d (7) {
75  ["property3"]=>
76  bool(true)
77  ["property4"]=>
78  float(10.5)
79  ["property1"]=>
80  int(99)
81  ["property2"]=>
82  string(5) "Hello"
83  ["date"]=>
84  string(26) "2009-02-03 12:34:41.000000"
85  ["timezone_type"]=>
86  int(2)
87  ["timezone"]=>
88  string(3) "GMT"
89}
90===DONE===
91