ID: 40492
Updated by: [EMAIL PROTECTED]
Reported By: rpg at terry-pratchett dot info
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: debian sarge
PHP Version: 5.2.1
New Comment:
>If you overload the function in the childclass it
>works, but this is actually not the idea behind OOP
I think inability to access child's private properties from parent's
scope is pretty much OO. This is actually how private properties work,
they cannot be accessed out of the class scope.
Previous Comments:
------------------------------------------------------------------------
[2007-02-15 08:54:26] rpg at terry-pratchett dot info
Description:
------------
The property_exists function returns true on private properties if
called within a class. That doesn't work, if it is called in a function
of a parent class. If you overload the function in the childclass it
works, but this is actually not the idea behind OOP ;-)
Reproduce code:
---------------
<?
class x {
private $x;
public function prop ($p) {
return property_exists($this,$p);
}
}
class y extends x {
private $y;
}
$x = new x;
echo 'prop(x): '.$x->prop('x').'<br>';
$y = new y;
echo 'prop(y): '.$y->prop('y').'<br>';
?>
Expected result:
----------------
you should see
prop(x): 1
prop(y): 1
Actual result:
--------------
prop(x): 1
prop(y):
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40492&edit=1