|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-10-15 03:40 UTC] matt dot lubner at gmail dot com
[2010-10-15 03:50 UTC] matt dot lubner at gmail dot com
[2010-12-20 13:15 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Scripting Engine problem
[2010-12-20 13:16 UTC] jani@php.net
-Package: Scripting Engine problem
+Package: Class/Object related
[2011-06-09 23:44 UTC] felipe@php.net
-Status: Open
+Status: Bogus
-Type: Feature/Change Request
+Type: Bug
[2011-06-09 23:44 UTC] felipe@php.net
[2012-08-14 18:13 UTC] loren at kanjoya dot com
[2012-08-14 20:37 UTC] stan at eproject-inc dot com
[2012-08-14 21:55 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 20:00:02 2025 UTC |
Description: ------------ A static call to Foo::bar() does not invoke __callStatic() if an instance method bar() exists. One reason you might want this is to convert static calls to Foo::bar() to the equivalent operation on a singleton: public static function __callStatic($name, $args) { $obj = self::getInstance(); return call_user_func_array(array($obj, $name), $args); } In the sample code below, __callStatic() is not invoked even though the caller has deliberately initiated a static call. Reproduce code: --------------- <?php class Foo { public static function __callStatic($name, $args) { echo "In __callStatic()\n"; } public function bar() { echo "In bar()\n"; } } echo Foo::bar(); Expected result: ---------------- In _callStatic() Actual result: -------------- PHP Strict Standards: Non-static method Foo::bar() should not be called statically in /mnt/hgfs/workspace/scratch/wart1.php on line 15 Strict Standards: Non-static method Foo::bar() should not be called statically in /mnt/hgfs/workspace/scratch/wart1.php on line 15 In bar()