#23459 [Asn->Csd]: Contents of private variables are available in inheriting classes.
ID: 23459
Updated by: zeev@php.net
Reported By: yoglets at hotmail dot com
-Status: Assigned
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: RH 7.3
PHP Version: 5CVS-2003-05-02 (dev)
-Assigned To: derick
+Assigned To: zeev
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-05-02 19:27:54] derick@php.net
I'll have a look at this...
------------------------------------------------------------------------
[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
Thread (3 messages)