From: jonas at gauffin dot org Operating system: winxp PHP version: 5.0.0b2 (beta2) PHP Bug Type: Class/Object related Bug description: __get($variable) do not work.
Description: ------------ __get do not work as I expected. I think that it should override member variables (and return them). Reproduce code: --------------- class testClass { private $myTest; function __get($memberVariable) { if ($memberVariable == 'myTest') return $this->myTest; } } $test = new testClass; echo $test->myTest; Expected result: ---------------- imho that's valid code. I do not want to change the variables to public since they are readonly. One way to do it would be to add a prefix to the member variables, but since $this have to be used to access the variables that would produce ugly code. Actual result: -------------- PHP Fatal error: Cannot access private property testclass::$myTest in E:\projects\inetpub\progga.se\test.php on line 46 -- Edit bug report at http://bugs.php.net/?id=26554&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26554&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26554&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26554&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26554&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26554&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=26554&r=needscript Try newer version: http://bugs.php.net/fix.php?id=26554&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26554&r=support Expected behavior: http://bugs.php.net/fix.php?id=26554&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26554&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26554&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26554&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26554&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26554&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26554&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26554&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26554&r=float