Bug #52591 [NEW]: possibility of calling protected static methods in not inherited classes

From: Date: Thu, 12 Aug 2010 10:52:33 +0000
Subject: Bug #52591 [NEW]: possibility of calling protected static methods in not inherited classes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153360@lists.php.net to get a copy of this message
From: Operating system: any PHP version: 5.2.14 Package: Scripting Engine problem Bug Type: Bug Bug description:possibility of calling protected static methods in not inherited classes Description: ------------ PHP allows to call protected static method in classes not inherited from class, that defines this method. See test script. We have two classes inherited from basic abstract class and we can call protected functions (defined abstract) of first class from second. Note, call_user_func caused error (works as expected). Test script: --------------- <?php abstract class A { abstract protected static function test(); } class B extends A { protected static function test() { return "abc"; } } abstract class C extends A { public static function do1() { return B::test();// Expected "Fatal error: Call to protected method..." } } echo C::do1(); // returns 'abc' Expected result: ---------------- Fatal error: Call to protected method B::test() from context 'C' Actual result: -------------- abc -- Edit bug report at http://bugs.php.net/bug.php?id=52591&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52591&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52591&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52591&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52591&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52591&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52591&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52591&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52591&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52591&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52591&r=support Expected behavior: http://bugs.php.net/fix.php?id=52591&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52591&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52591&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52591&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52591&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52591&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52591&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52591&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52591&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52591&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52591&r=mysqlcfg

« previous php.bugs (#153360) next »