ID: 37632 Updated by: [EMAIL PROTECTED] Reported By: stochnagara at hotmail dot com Status: Assigned Bug Type: Class/Object related Operating System: * PHP Version: 5CVS-2006-05-29 (snap) Assigned To: helly New Comment:
Fixed in 5.2, HEAD. Since the rule cannot be fixed for properties in 5.1 it stays the same for methods in 5.1, too. That way we lower the WTF factor. 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