1--TEST-- 2Get property hook by ref and indirect modification 3--FILE-- 4<?php 5 6class Test { 7 public $byVal { 8 get { return $this->byVal; } 9 set { $this->byVal = $value; } 10 } 11} 12 13$test = new Test; 14 15try { 16 $test->byVal = []; 17 $test->byVal[] = 42; 18} catch (\Error $e) { 19 echo $e->getMessage(), "\n"; 20} 21var_dump($test->byVal); 22 23try { 24 $test->byVal =& $ref; 25} catch (Error $e) { 26 echo $e->getMessage(), "\n"; 27} 28 29?> 30--EXPECT-- 31Indirect modification of Test::$byVal is not allowed 32array(0) { 33} 34Cannot assign by reference to overloaded object 35