<?php
error_reporting(E_STRICT | E_ALL);
class y {
public function __get($k) {
}
}
class x extends y {
protected $_x = array();
public function &__get($k) {
return $this->_x;
}
}
$x =new x;
$x->a['b'] = 4;
print_r($x);
Strict Standards: Declaration of x::__get() should be compatible with that of y::__get() in /in/d3TcF on line 13
x Object
(
[_x:protected] => Array
(
[b] => 4
)
)
Output for 5.2.0
Strict Standards: Declaration of x::__get() should be compatible with that of y::__get() in /in/d3TcF on line 13
Notice: Indirect modification of overloaded property x::$a has no effect in /in/d3TcF on line 16
x Object
(
[_x:protected] => Array
(
)
)
Output for 5.0.0 - 5.0.3
Strict Standards: Declaration of x::__get() should be compatible with that of y::__get() in /in/d3TcF on line 13
Fatal error: Cannot access undefined property for object with overloaded property access in /in/d3TcF on line 16
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/d3TcF on line 4
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/d3TcF on line 4
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/d3TcF on line 4
Process exited with code 255.