From:             steve at mountainmedia dot com
Operating system: Fedora Core 4/Linux 2.6.14.3
PHP version:      5.1.6
PHP Bug Type:     Class/Object related
Bug description:  Private members accessible to print_r

Description:
------------
Private variables are accessible to the print_r function outside of the
object.  Even if one cannot access the variable directly, one could easily
parse the output of print_r to grab private data from an object.

Reproduce code:
---------------
<?

class Example {
        private $secret = "My secret";
        public $notsecret = "Not my secret";
}
$ex = new Example;
$x = print_r ($ex, true);
print $x;


?>

Expected result:
----------------
I expected the private members to be invisible or replaced with something
to indicate the lack of access such as <Private>.

Actual result:
--------------
Example Object
(
    [secret:private] => My secret
    [notsecret] => Not my secret
)


Private variables are displayed and data is stored in the string variable
$x which one could easily parse to get the value of secret:private.

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

Reply via email to