1--TEST-- 2Bug #32660 (Assignment by reference causes crash when field access is overloaded (__get)) 3--FILE-- 4<?php 5class A 6{ 7 public $q; 8 9 function __construct() 10 { 11 $this->q = 3;//array(); 12 } 13 14 function __get($name) 15 { 16 return $this->q; 17 } 18} 19 20$a = new A; 21 22$b = "short"; 23$c =& $a->whatever; 24$c = "long"; 25print_r($a); 26$a->whatever =& $b; 27$b = "much longer"; 28print_r($a); 29?> 30--EXPECTF-- 31Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 20 32A Object 33( 34 [q] => 3 35) 36 37Notice: Indirect modification of overloaded property A::$whatever has no effect in %sbug32660.php on line 23 38 39Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %sbug32660.php:23 40Stack trace: 41#0 {main} 42 thrown in %sbug32660.php on line 23 43