|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-03-14 02:47 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2019-03-14 02:47 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 13 14:00:01 2025 UTC |
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)