|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-28 18:52 UTC] johannes@php.net
[2008-07-28 21:15 UTC] gwd at heex dot pl
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 19:00:01 2025 UTC |
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!