1--TEST-- 2Attempting to obtain reference of object of private(set) object returns a copy instead 3--FILE-- 4<?php 5 6class Foo { 7 public private(set) Bar $bar; 8 9 public function __construct() { 10 $this->bar = new Bar(); 11 } 12} 13 14class Bar {} 15 16function test() { 17 $foo = new Foo(); 18 $bar = &$foo->bar; 19 var_dump($foo); 20} 21 22test(); 23// Test zend_fetch_property_address with warmed cache 24test(); 25 26?> 27--EXPECT-- 28object(Foo)#1 (1) { 29 ["bar"]=> 30 object(Bar)#2 (0) { 31 } 32} 33object(Foo)#2 (1) { 34 ["bar"]=> 35 object(Bar)#1 (0) { 36 } 37} 38