#37632 [Opn->Asn]: Protected method access problem (similar bug 37212)

From: Date: Mon, 29 May 2006 18:45:32 +0000
Subject: #37632 [Opn->Asn]: Protected method access problem (similar bug 37212)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97762@lists.php.net to get a copy of this message
ID: 37632 Updated by: helly@php.net Reported By: stochnagara at hotmail dot com -Status: Open +Status: Assigned Bug Type: Class/Object related -Operating System: windows xp +Operating System: * PHP Version: 5CVS-2006-05-29 (snap) -Assigned To: +Assigned To: helly Previous Comments: ------------------------------------------------------------------------ [2006-05-29 18:43:24] stochnagara at hotmail dot com Description: ------------ In class structures where the sub-classes are extended non-linearly (i.e. multiple classes on the same tier), the sub-classes in different lines cannot access methods defined as protected in a shared parent class in eachother. Actually this is a clone of bug 37212 but for method instead of variables. Reproduce code: --------------- class A { protected function testProtected() { echo "Test Protected Called in A"; } } class B extends A { public function doTest (A $obj) { $obj->testProtected(); } } class C extends A { protected function testProtected() { echo "Test Protected Called in C"; } } $B = new B; $C = new C; $B->doTest ($C); // fatal ?> Expected result: ---------------- Test Protected Called in C Actual result: -------------- Fatal error: Call to protected method C::testProtected() from context 'B' in c:\program files\apache group\Apache\htdocs\cinh.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37632&edit=1

« previous php.bugs (#97762) next »