|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2013-01-23 23:38 UTC] php at anthonybishopric dot com
  [2013-01-23 23:38 UTC] php at anthonybishopric dot com
 
-Status:      Open
+Status:      Closed
-PHP Version: 5.4.11
+PHP Version: 5.4.11, 5.3.x
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 11:00:01 2025 UTC | 
Description: ------------ PHP 5.4 seems to have changed the behavior of __callStatic when invoked inside the object context of the defining class. If both __call and __callStatic are defined, then inaccessible methods when invoked with a static context are sent to __callStatic. However, inside an object context, inaccessible methods that use the 'static', 'self' or $classname to invoke the method still get delegated to __call. In 5.3, statically invoked, inaccessible methods delegated to __callStatic, no matter where they are invoked. This is a breaking change that should be listed on the PHP 5.4 backwards incompatible change list. If this is an unintended change it should be fixed as a bug. Test script: --------------- class Magic{ public static function __callStatic($name, $args){ echo "__callStatic($name) invoked!\n"; } public function __call($name, $args){ echo "__call($name) invoked!\n"; } public function foo(){ Magic::bar(); // __call, but should be __callStatic static::bar(); // __call, but should be __callStatic self::bar(); // __call, but should be __callStatic $this->bar(); // correctly is __call } } $magic = new Magic(); $magic->foo(); Expected result: ---------------- __callStatic(bar) invoked! __callStatic(bar) invoked! __callStatic(bar) invoked! __call(bar) invoked! Actual result: -------------- __call(bar) invoked! __call(bar) invoked! __call(bar) invoked! __call(bar) invoked!