#51176 [NEW]: Static calling in non-static method behaves like $this->
From: majkl578 at gmail dot com
Operating system: Irrelevant
PHP version: 5.3.2RC3
PHP Bug Type: Scripting Engine problem
Bug description: Static calling in non-static method behaves like $this->
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
--
Edit bug report at http://bugs.php.net/?id=51176&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51176&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51176&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51176&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51176&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51176&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51176&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51176&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51176&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51176&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51176&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51176&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51176&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51176&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51176&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51176&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51176&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51176&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51176&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51176&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51176&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51176&r=mysqlcfg
Thread (12 messages)
- majkl578 at gmail dot com
- felipe@php.netBug #51176 [Opn->Csd]: Static calling in non-static method behaves like $this->
- majkl578 at gmail dot comBug #51176 [Csd]: Static calling in non-static method behaves like $this->
- majkl578 at gmail dot comBug #51176 [Csd]: Static calling in non-static method behaves like $this->
- felipe@php.netBug #51176 [Csd]: Static calling in non-static method behaves like $this->
- felipe@php.netBug #51176 [Csd->Bgs]: Static calling in non-static method behaves like $this->
- majkl578 at gmail dot comBug #51176 [Bgs]: Static calling in non-static method behaves like $this->
- david71rj at gmail dot comBug #51176 [Com]: Static calling in non-static method behaves like $this->
- steve at twitpic dot comBug #51176 [Com]: Static calling in non-static method behaves like $this->
- daniel dot ruthardt at zoesolutions dot euBug #51176 [Com]: Static calling in non-static method behaves like $this->
- kak dot serpom dot po dot yaitsam at gmail dot comBug #51176 [Com]: Static calling in non-static method behaves like $this->
- kusov26an at gmail dot comBug #51176 [Com]: Static calling in non-static method behaves like $this->