ID: 26554 Comment by: php at nowhere dot net Reported By: jonas at gauffin dot org Status: Open Bug Type: Feature/Change Request Operating System: winxp PHP Version: 5.0.0b2 (beta2) New Comment:
This test code appears to work now. Should this be closed? Previous Comments: ------------------------------------------------------------------------ [2003-12-08 13:22:22] [EMAIL PROTECTED] This is not really a bug, making it a feature request. ------------------------------------------------------------------------ [2003-12-08 13:20:14] jonas at gauffin dot org 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 this bug report at http://bugs.php.net/?id=26554&edit=1