Static calling in non-static method behaves like $this->
| Bug #51176 | Static calling in non-static method behaves like $this-> | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2010-03-01 16:53 UTC | Modified: | 2010-11-03 12:03 UTC |
|
||||||||||
| From: | majkl578 at gmail dot com | Assigned: | felipe (profile) | |||||||||||
| Status: | Not a bug | Package: | Scripting Engine problem | |||||||||||
| PHP Version: | 5.3.2RC3 | OS: | Irrelevant | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2010-03-01 16:53 UTC] majkl578 at gmail dot com
Description:
------------
When calling non-existing static method from non-static method, __call() is called instead of __callStatic().
self/static/className behaves incorrectly - like $this-> in that context.
Verified on 5.3.2RC3, 5.3.1 and 5.3.0.
Reproduce code:
---------------
class Foo
{
public function start()
{
self::bar();
static::bar();
Foo::bar();
}
public function __call($n, $a)
{
echo 'instance';
}
public static function __callStatic($n, $a)
{
echo 'static';
}
}
$foo = new Foo();
$foo->start();
Expected result:
----------------
static
static
static
Actual result:
--------------
instance
instance
instance
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2010-03-02 01:17 UTC] felipe@php.net
[2010-03-02 13:37 UTC] majkl578 at gmail dot com
[2010-03-04 12:33 UTC] majkl578 at gmail dot com
[2010-03-04 14:27 UTC] felipe@php.net
[2010-11-03 02:45 UTC] felipe@php.net
[2010-11-03 12:03 UTC] majkl578 at gmail dot com
[2011-07-29 15:57 UTC] steve at twitpic dot com
[2013-08-17 13:59 UTC] daniel dot ruthardt at zoesolutions dot eu
[2016-04-13 20:43 UTC] kak dot serpom dot po dot yaitsam at gmail dot com
[2023-05-20 15:11 UTC] kusov26an at gmail dot com