1--TEST-- 2Interaction of inaccessible property hooks with magic methods 3--FILE-- 4<?php 5 6class A { 7 public $prop { 8 get { 9 echo __METHOD__, "\n"; 10 return 'prop'; 11 } 12 set { echo __METHOD__, "\n"; } 13 } 14} 15 16class B extends A { 17 public function __get($name) { 18 echo __METHOD__, "($name)\n"; 19 try { 20 $this->$name; 21 } catch (Error $e) { 22 echo $e->getMessage(), "\n"; 23 } 24 } 25 public function __set($name, $value) { 26 echo __METHOD__, "($name, $value)\n"; 27 try { 28 $this->$name = $value; 29 } catch (Error $e) { 30 echo $e->getMessage(), "\n"; 31 } 32 } 33 public function __isset($name) { 34 echo __METHOD__, "($name)\n"; 35 try { 36 var_dump(isset($this->$name)); 37 } catch (Error $e) { 38 echo $e->getMessage(), "\n"; 39 } 40 } 41 public function __unset($name) { 42 echo "Never reached\n"; 43 } 44} 45 46$b = new B; 47$b->prop; 48var_dump(isset($b->prop)); 49$b->prop = 1; 50try { 51 unset($b->prop); 52} catch (Error $e) { 53 echo $e->getMessage(), "\n"; 54} 55 56?> 57--EXPECT-- 58A::$prop::get 59A::$prop::get 60bool(true) 61A::$prop::set 62Cannot unset hooked property B::$prop 63