#45648 [Opn->Bgs]: Visibility of private in another Obj of that same class
| From: | johannes@php.net | Date: | Mon, 28 Jul 2008 18:52:14 +0000 |
| Subject: | #45648 [Opn->Bgs]: Visibility of private in another Obj of that same class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-127349@lists.php.net to get a copy of this message | ||
ID: 45648
Updated by: johannes@php.net
Reported By: gwd at heex dot pl
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Win XP
PHP Version: 5.2.6
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
Visibility is bound to the class, not the object.
Previous Comments:
------------------------------------------------------------------------
[2008-07-28 18:21:46] gwd at heex dot pl
Description:
------------
Private/protected property/method is visible in methods of another
object of that same class
Reproduce code:
---------------
class A {
private $sameVar = "it's private variable!<br>";
private function testMthd () {
echo "it's private method!<br>";
}
public function testVar($otherObj) {
echo $otherObj->sameVar;
$otherObj->testMthd();
}
}
$sm1 = new A();
$sm2 = new A();
$sm1->testVar($sm2);
Expected result:
----------------
it should rise an "Fatal error: Cannot access private property"
Actual result:
--------------
it's private variable!
it's private method!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45648&edit=1