ID: 28444 Comment by: cunha17 at uol dot com dot br Reported By: dennis at inmarket dot lviv dot ua Status: Analyzed Bug Type: Class/Object related Operating System: WinXP PHP Version: 5.0.0RC2 New Comment:
This odd behavior is still present in latest CVS and happens in Linux also. Cristiano Duarte Previous Comments: ------------------------------------------------------------------------ [2004-05-27 16:11:39] dennis at inmarket dot lviv dot ua Well, I am not familiar with the engine code, but it works for getting "undefined property for object with overloaded property access", as the reproduce code clearly shows. ------------------------------------------------------------------------ [2004-05-27 12:15:55] [EMAIL PROTECTED] The problem here is that it is unclear what actually should happen in this case. When executing $y->x->x = 3, we need to fetch $y->x for writing, i.e., get zval** of it. However, only handler that could give it to us is get_property_ptr_ptr and it is not overridable. We probably could use the result of __get, though it would mean we would have to fake zval**, which could have some strange consequences - needs to be checked. ------------------------------------------------------------------------ [2004-05-19 12:34:23] dennis at inmarket dot lviv dot ua Description: ------------ "Cannot access undefined property for object with overloaded property access" is an error when I try to set a property of an instance, which, in turn, is a property of another instance of an overloaded class, i.e. $a->x->y = 2 triggers the error if $a is an instance of an overloaded class. Note that getting that property works fine. Reproduce code: --------------- class Object { public $x; function __construct($x) { $this->x = $x; } } class Overloaded { var $props; function __construct($x) { $this->x = new Object($x); } function __get($prop) { return $this->props[$prop]; } function __set($prop, $val) { $this->props[$prop] = $val; } } $y = new Overloaded(2); echo $y->x->x, " "; // Prints 2... echo $y->x->x = 3; //Should print 3... Expected result: ---------------- 2 3 Actual result: -------------- 2 Fatal error: Cannot access undefined property for object with overloaded property access in path/to/script.php on line 22 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28444&edit=1