1--TEST-- 2Indirect method call and cloning 3--FILE-- 4<?php 5 6 7class bar { 8 public $z; 9 10 public function __construct() { 11 $this->z = new stdclass; 12 } 13 public function getZ() { 14 return $this->z; 15 } 16} 17 18var_dump(clone (new bar)->z); 19var_dump(clone (new bar)->getZ()); 20 21?> 22--EXPECTF-- 23object(stdClass)#%d (0) { 24} 25object(stdClass)#%d (0) { 26} 27