|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-02-15 09:02 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 13:00:02 2025 UTC |
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):