ID: 44784 Updated by: [EMAIL PROTECTED] Reported By: marvinpaul at mapkreke dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows Vista PHP Version: 5.2.5 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. That's expected, from the context of ParentClass::__get, any private property of the child class won't be accessible. Previous Comments: ------------------------------------------------------------------------ [2008-04-20 01:17:19] marvinpaul at mapkreke dot com Description: ------------ If you have a child class that inherits from a parent class that implements __get and __set and you access a private property from within these functions, then you will get a notice "Undefined property" when trying to access this property from an instance of the child class. If you try accessing the properties from an instance of the parent class, it works as expected. Reproduce code: --------------- class ParentClass { private $parentMessage = "Hello, from parent!"; private function __get($property) { echo "__get($$property)\n"; return $this->$property; } private function __set($property, $value) { echo "__set($$property, $value)\n"; $this->$property = $value; } } class ChildClass extends ParentClass { private $childMessage = "Hello, from child!"; } $parent = new ParentClass(); echo $parent->parentMessage . "\n"; $child = new ChildClass(); echo $child->childMessage . "\n"; Expected result: ---------------- __get($parentMessage) Hello, from parent! __get($childMessage) Hello, from child! Actual result: -------------- __get($parentMessage) Hello, from parent! __get($childMessage) Notice: Undefined property: ChildClass::$childMessage in C:\www\bug.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44784&edit=1