ID: 26554
Updated by: [EMAIL PROTECTED]
Reported By: jonas at gauffin dot org
Status: Open
-Bug Type: Class/Object related
+Bug Type: Feature/Change Request
Operating System: winxp
PHP Version: 5.0.0b2 (beta2)
New Comment:
This is not really a bug, making it a feature request.
Previous Comments:
------------------------------------------------------------------------
[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