Bug #77740 [NEW]: called static direct from brother class

From: Date: Thu, 14 Mar 2019 02:40:48 +0000
Subject: Bug #77740 [NEW]: called static direct from brother class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219954@lists.php.net to get a copy of this message
From: neder dot fandino at outlook dot com Operating system: Centos 7.0 PHP version: 7.3.3 Package: Class/Object related Bug Type: Bug Bug description:called static direct from brother class Description: ------------ When calling a dynamically protected method from a sibling class, the current class does not use the magic method __callStatic Test script: --------------- <?php class Father { protected function methodProctected() { return __FUNCTION__; } public static function __callStatic($name, $arguments) { $self = new static; return call_user_func_array([$self, $name], $arguments); } } var_dump(Father::methodProctected()); // print: string(16) "methodProctected" class MajorChild extends Father {} var_dump(MajorChild::methodProctected()); // print: string(16) "methodProctected" class MinorChild extends Father { public static function methodPublic() { return MajorChild::methodProctected(); } } var_dump(MinorChild::methodPublic()); // print: WARNING Non-static method Father::methodProctected() should not be called statically on line number 26 string(16) "methodProctected" Expected result: ---------------- should execute the method inherited from the father through the magical method __callStatic Actual result: -------------- WARNING The non-static method should not be called statically (try to execute the method as yourself) -- Edit bug report at https://bugs.php.net/bug.php?id=77740&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77740&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77740&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77740&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77740&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77740&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77740&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77740&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77740&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77740&r=support Expected behavior: https://bugs.php.net/fix.php?id=77740&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77740&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77740&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77740&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77740&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77740&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77740&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77740&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77740&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77740&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77740&r=mysqlcfg

« previous php.bugs (#219954) next »