#23459 [Opn->Asn]: Contents of private variables are available in inheriting classes.

From: Date: Sat, 03 May 2003 00:27:54 +0000
Subject: #23459 [Opn->Asn]: Contents of private variables are available in inheriting classes.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38977@lists.php.net to get a copy of this message
ID: 23459 Updated by: derick@php.net Reported By: yoglets at hotmail dot com -Status: Open +Status: Assigned Bug Type: Zend Engine 2 problem Operating System: RH 7.3 PHP Version: 5CVS-2003-05-02 (dev) -Assigned To: +Assigned To: derick New Comment: I'll have a look at this... Previous Comments: ------------------------------------------------------------------------ [2003-05-02 19:10:07] yoglets at hotmail dot com 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 this bug report at http://bugs.php.net/?id=23459&edit=1

« previous php.bugs (#38977) next »