1--TEST-- 2Property access errors should be thrown for overloaded properties protected by recursion guards 3--FILE-- 4<?php 5 6function setProp($obj) { 7 $obj->prop = 42; 8} 9 10function getProp($obj) { 11 var_dump($obj->prop); 12} 13 14function unsetProp($obj) { 15 unset($obj->prop); 16} 17 18class Test { 19 private $prop; 20 21 public function __get($k) { 22 getProp($this); 23 } 24 25 public function __set($k, $v) { 26 setProp($this); 27 } 28 29 public function __unset($k) { 30 unsetProp($this); 31 } 32} 33 34$test = new Test; 35try { 36 $test->prop = "bar"; 37} catch (Error $e) { 38 echo $e->getMessage(), "\n"; 39} 40try { 41 var_dump($test->prop); 42} catch (Error $e) { 43 echo $e->getMessage(), "\n"; 44} 45try { 46 unset($test->prop); 47} catch (Error $e) { 48 echo $e->getMessage(), "\n"; 49} 50 51?> 52--EXPECT-- 53Cannot access private property Test::$prop 54Cannot access private property Test::$prop 55Cannot access private property Test::$prop 56