ID: 29458 Updated by: [EMAIL PROTECTED] Reported By: hawcue at yahoo dot com -Status: Open +Status: Closed Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5.0.0 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-07-30 16:03:05] hawcue at yahoo dot com Description: ------------ Part of this report is related with BUG#24807. In the following code, I would like to get and set an object property in the way similar to that in Java, C# and Delphi, e.g., "$a->Child->Name='xxx'" and "echo $a->Child->Name". However, the PHP parser would not allow the first usage. Another question is about array property. Within current PHP5 release, I can't see a way to define an object property that is of array type and supports access to individual array element. These two questions may not be considered as bugs, however, to my belief they are very fundamental to object properties. Reproduce code: --------------- class Input { private $_name='abc'; private $_child; function __get($name) { if($name=='Name') return $this->_name; else if($name=='Child') { if(!isset($this->_child)) $this->_child=new Input; return $this->_child; } } function __set($name,$value) { if($name=='Name') $this->_name=$value; } } $a=new Input; $a->Child->Name='cde'; echo $a->Child->Name; Expected result: ---------------- cde Actual result: -------------- Fatal error: Cannot access undefined property for object with overloaded property access ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29458&edit=1