#32915 [Opn->Bgs]: objects of the same class can access private variables

From: Date: Mon, 02 May 2005 19:12:06 +0000
Subject: #32915 [Opn->Bgs]: objects of the same class can access private variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78532@lists.php.net to get a copy of this message
ID: 32915 Updated by: helly@php.net Reported By: rashid at ds dot pg dot gda dot pl -Status: Open +Status: Bogus Bug Type: Zend Engine 2 problem -Operating System: win2k +Operating System: * -PHP Version: 5.0.4 +PHP Version: 5.* New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php It is the same scope :-) Previous Comments: ------------------------------------------------------------------------ [2005-05-02 20:20:32] rashid at ds dot pg dot gda dot pl 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 this bug report at http://bugs.php.net/?id=32915&edit=1

« previous php.bugs (#78532) next »