__get() not reentrant?
| From: | Christopher J. Bottaro | Date: | Fri, 20 May 2005 19:41:13 +0000 |
| Subject: | __get() not reentrant? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-215666@lists.php.net to get a copy of this message | ||
Maybe I'm using "reentrant" incorrectly, but here is what I mean...
class Test {
function __get($nm) {
if ($nm == 'x')
return $this->func();
elseif ($nm == 'y')
return 'y';
elseif ($nm == 'xx')
return 'x';
}
function func() {
return $this->xx;
}
}
$t = new Test();
print $t->y . "\n";
print $t->xx . "\n";
print $t->x . "\n";
print $t->func() . "\n";
I would expect the following code to output:
y
x
x
x
But instead, it outputs:
y
x
x
Is this a bug? This limitation is not documented (maybe it should be?).
-- C