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