#23459 [NEW]: Contents of private variables are available in inheriting classes.

From: Date: Sat, 03 May 2003 00:10:07 +0000
Subject: #23459 [NEW]: Contents of private variables are available in inheriting classes.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38975@lists.php.net to get a copy of this message
From: yoglets at hotmail dot com Operating system: RH 7.3 PHP version: 5CVS-2003-05-02 (dev) PHP Bug Type: Zend Engine 2 problem Bug description: Contents of private variables are available in inheriting classes. Given: <?php class foo { private $message = 'this is a secret'; } class bar extends foo { } $obj = new bar; print_r($obj); ?> Yields: bar Object ( [] => this is a secret ) While the variable in question is "unnamed" and can't be referenced directly (i.e., via $obj->message), its value _is_ available, which certainly seems counter-intuitive to its declaration of privacy. This seems related to bug #23272, but I think it warrants its own ticket, as I believe it's more severe. (Especially considering the wasted memory allocation.) -- Edit bug report at http://bugs.php.net/?id=23459&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23459&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23459&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23459&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23459&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23459&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23459&r=support Expected behavior: http://bugs.php.net/fix.php?id=23459&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23459&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23459&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23459&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23459&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23459&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23459&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23459&r=gnused

« previous php.bugs (#38975) next »