1--TEST-- 2Handling of assign-ops and incdecs on overloaded properties using &__get() 3--FILE-- 4<?php 5 6class Test { 7 protected $a = 0; 8 protected $b = 0; 9 protected $c = 0; 10 11 public function &__get($name) { 12 echo "get($name)\n"; 13 return $this->$name; 14 } 15 16 public function __set($name, $value) { 17 echo "set($name, $value)\n"; 18 } 19} 20 21$test = new Test; 22 23var_dump($test->a += 1); 24var_dump($test->b++); 25var_dump(++$test->c); 26 27var_dump($test); 28 29?> 30--EXPECT-- 31get(a) 32set(a, 1) 33int(1) 34get(b) 35set(b, 1) 36int(0) 37get(c) 38set(c, 1) 39int(1) 40object(Test)#1 (3) { 41 ["a":protected]=> 42 int(0) 43 ["b":protected]=> 44 int(0) 45 ["c":protected]=> 46 int(0) 47} 48