<?php
class Foo
{
public $publicProperty = array();
}
class Bar
{
public function __get($name)
{
return $this->wrapped->$name;
}
}
$bar = new Bar(new Foo());
$bar->publicProperty['example'] = 'Hello World!';
var_dump($bar->publicProperty);
Warning: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Warning: Attempt to read property "wrapped" on null in /in/GMVBC on line 12
Warning: Attempt to read property "publicProperty" on null in /in/GMVBC on line 12
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/GMVBC on line 18
Warning: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Warning: Attempt to read property "wrapped" on null in /in/GMVBC on line 12
Warning: Attempt to read property "publicProperty" on null in /in/GMVBC on line 12
NULL
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property 'wrapped' of non-object in /in/GMVBC on line 12
Notice: Trying to get property 'publicProperty' of non-object in /in/GMVBC on line 12
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/GMVBC on line 18
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property 'wrapped' of non-object in /in/GMVBC on line 12
Notice: Trying to get property 'publicProperty' of non-object in /in/GMVBC on line 12
NULL
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/GMVBC on line 18
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
NULL
Output for 5.2.0 - 5.2.5
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/GMVBC on line 18
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
NULL
Output for 5.1.0 - 5.1.6
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
NULL
Output for 5.0.4 - 5.0.5
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
Notice: Undefined property: Bar::$wrapped in /in/GMVBC on line 12
Notice: Trying to get property of non-object in /in/GMVBC on line 12
NULL
Output for 5.0.0 - 5.0.3
Fatal error: Cannot access undefined property for object with overloaded property access in /in/GMVBC on line 18
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/GMVBC on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/GMVBC on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/GMVBC on line 5
Process exited with code 255.