#32915 [NEW]: objects of the same class can access private variables

From: Date: Mon, 02 May 2005 18:20:33 +0000
Subject: #32915 [NEW]: objects of the same class can access private variables
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78531@lists.php.net to get a copy of this message
From: rashid at ds dot pg dot gda dot pl Operating system: win2k PHP version: 5.0.4 PHP Bug Type: Zend Engine 2 problem Bug description: objects of the same class can access private variables Description: ------------ It seems like objects of the same class can access private variables in each other. Access rights check is based on class name instead of reference? Reproduce code: --------------- <?php class strange { private $_amount = 10; public function foo($other) { echo $other->_amount; $other->_amount = 666; } } $t = new strange(); $t->foo(new strange()); ?> Expected result: ---------------- fatal error Actual result: -------------- 10 -- Edit bug report at http://bugs.php.net/?id=32915&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32915&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32915&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32915&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32915&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32915&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32915&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32915&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32915&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32915&r=support Expected behavior: http://bugs.php.net/fix.php?id=32915&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32915&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32915&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32915&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32915&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32915&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32915&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32915&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32915&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32915&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32915&r=mysqlcfg

« previous php.bugs (#78531) next »