|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-12-25 01:12 UTC] hongweichen8888 at sina dot com
Description:
------------
When using the __call and __callStatic functionality on a parent class calls to A::method() will use __call rather than the __callStatic.
Test script:
---------------
class A {
function __call($name, $arguments) {
echo "non-static\n";
}
static function __callStatic($name, $arguments){
echo "static\n";
}
}
class B extends A {
function fun() {
parent::test(); // with calling scope
A::test(); // ?
}
}
$obj = new B();
$obj->fun();
Expected result:
----------------
non-static
static
Actual result:
--------------
non-static
non-static
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 00:00:01 2025 UTC |
class C { // without extends function fun() { A::test(); } } $obj2 = new C(); $obj2->fun(); // output: static In this case, is $this not set?