#37632 [NEW]: Protected method access problem (similar bug 37212)

From: Date: Mon, 29 May 2006 18:43:24 +0000
Subject: #37632 [NEW]: Protected method access problem (similar bug 37212)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97761@lists.php.net to get a copy of this message
From: stochnagara at hotmail dot com Operating system: windows xp PHP version: 5CVS-2006-05-29 (snap) PHP Bug Type: Class/Object related Bug description: Protected method access problem (similar bug 37212) 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 bug report at http://bugs.php.net/?id=37632&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37632&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37632&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37632&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37632&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37632&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37632&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37632&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37632&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37632&r=support Expected behavior: http://bugs.php.net/fix.php?id=37632&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37632&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37632&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37632&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37632&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37632&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37632&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37632&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37632&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37632&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37632&r=mysqlcfg

« previous php.bugs (#97761) next »