ID: 45097 Updated by: [EMAIL PROTECTED] Reported By: ndaugherty987 at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: linux PHP Version: 5.2.6 New Comment:
This is expected, use protected/public visibility. Previous Comments: ------------------------------------------------------------------------ [2008-05-26 18:54:47] ndaugherty987 at gmail dot com Description: ------------ The magic overloading function __get() can't seem to access inherited, non-visible properties. If you overload with __get() in a base class, then extend that class, the base class's __get() will return NULL when accessing an inaccessible property of the child class. The __get() function doesn't even see the property as being set (if you run an isset($name) in the __get() call, it returns false. Reproduce code: --------------- class testParent { function __get($name){ return $this->$name; } } class testChild extends testParent { private $testVar = 'Bar'; } $t = new testChild; echo 'Foo: ' . $t->testVar; Expected result: ---------------- You would expect the code to output 'Foo: Bar'. instead, it outputs 'Foo:', because the __get() in testParent apparently can't see the private vars in testChild. Actual result: -------------- Output's 'Foo:', withOUT the 'Bar' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45097&edit=1