php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23459 Contents of private variables are available in inheriting classes.
Submitted: 2003-05-02 19:10 UTC Modified: 2003-06-08 13:54 UTC
From: yoglets at hotmail dot com Assigned: zeev (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-05-02 (dev) OS: RH 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: yoglets at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-05-02 19:10 UTC] 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.)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-02 19:27 UTC] derick@php.net
I'll have a look at this...
 [2003-06-08 13:54 UTC] zeev@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC