1--TEST-- 2Testing clone on objects whose 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 whose 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--EXPECTF-- 32*** Testing clone on objects whose class derived from DateTimeZone class *** 33object(DateTimeZoneExt1)#%d (4) { 34 ["property1"]=> 35 int(99) 36 ["property2"]=> 37 string(5) "Hello" 38 ["timezone_type"]=> 39 int(3) 40 ["timezone"]=> 41 string(13) "Europe/London" 42} 43object(DateTimeZoneExt1)#%d (4) { 44 ["property1"]=> 45 int(99) 46 ["property2"]=> 47 string(5) "Hello" 48 ["timezone_type"]=> 49 int(3) 50 ["timezone"]=> 51 string(13) "Europe/London" 52} 53object(DateTimeZoneExt2)#%d (6) { 54 ["property1"]=> 55 int(99) 56 ["property2"]=> 57 string(5) "Hello" 58 ["property3"]=> 59 bool(true) 60 ["property4"]=> 61 float(10.5) 62 ["timezone_type"]=> 63 int(3) 64 ["timezone"]=> 65 string(13) "Europe/London" 66} 67object(DateTimeZoneExt2)#%d (6) { 68 ["property1"]=> 69 int(99) 70 ["property2"]=> 71 string(5) "Hello" 72 ["property3"]=> 73 bool(true) 74 ["property4"]=> 75 float(10.5) 76 ["timezone_type"]=> 77 int(3) 78 ["timezone"]=> 79 string(13) "Europe/London" 80} 81