<?php
class Foo
{
public $publicProperty = array();
}
class Bar
{
public function __construct()
{
unset($this->publicProperty);
}
public function __get($name)
{
return $this->{$name};
}
}
$bar = new Bar();
$bar->publicProperty['example'] = 'Hello World!';
var_dump($bar->publicProperty);
Warning: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/EqAgi on line 23
Warning: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
NULL
Notice: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/EqAgi on line 23
Notice: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
NULL
Output for 7.3.32 - 7.3.33, 7.4.26
NULL
Output for 5.2.0 - 5.2.5
Notice: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/EqAgi on line 23
Notice: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
NULL
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6
Notice: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
Notice: Undefined property: Bar::$publicProperty in /in/EqAgi on line 17
NULL
Output for 5.0.0 - 5.0.3
Fatal error: Cannot access undefined property for object with overloaded property access in /in/EqAgi on line 23
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/EqAgi 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/EqAgi 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/EqAgi on line 5
Process exited with code 255.