From:             rpg at terry-pratchett dot info
Operating system: debian sarge
PHP version:      5.2.1
PHP Bug Type:     Feature/Change Request
Bug description:  property_exists called in parent class doesn work on private 
property of subcla

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 bug report at http://bugs.php.net/?id=40492&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40492&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40492&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40492&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40492&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40492&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40492&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40492&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40492&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40492&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40492&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40492&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40492&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40492&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40492&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40492&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40492&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40492&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40492&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40492&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40492&r=mysqlcfg

Reply via email to