<?php
class Foo
{
public $publicProperty = array();
}
class Bar
{
public function __construct(Foo $foo)
{
$this->wrapped = $foo;
}
public function __get($name)
{
return $this->wrapped->$name;
}
}
$bar = new Bar(new Foo());
$bar->publicProperty['example'] = 'Hello World!';
var_dump($bar->publicProperty);
Deprecated: Creation of dynamic property Bar::$wrapped is deprecated in /in/g95jQ on line 12
Notice: Indirect modification of overloaded property Bar::$publicProperty has no effect in /in/g95jQ on line 23
array(0) {
}
Fatal error: Cannot access undefined property for object with overloaded property access in /in/g95jQ 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/g95jQ 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/g95jQ 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/g95jQ on line 5
Process exited with code 255.