ID:               45648
 User updated by:  gwd at heex dot pl
 Reported By:      gwd at heex dot pl
 Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Win XP
 PHP Version:      5.2.6
 New Comment:

Sorry, my fault. I should know it.


Previous Comments:
------------------------------------------------------------------------

[2008-07-28 18:52:13] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[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

Reply via email to