Bug #51176 [Opn->Csd]: Static calling in non-static method behaves like $this->

From: Date: Tue, 02 Mar 2010 00:17:06 +0000
Subject: Bug #51176 [Opn->Csd]: Static calling in non-static method behaves like $this->
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148153@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51176&edit=1

 ID:               51176
 Updated by:       felipe@php.net
 Reported by:      majkl578 at gmail dot com
 Summary:          Static calling in non-static method behaves like
                   $this->
-Status:           Open
+Status:           Closed
 Type:             Bug
 Package:          Scripting Engine problem
 Operating System: Irrelevant
 PHP Version:      5.3.2RC3
 Assigned To:      felipe

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-03-02 01:17:06] felipe@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------
[2010-03-01 16:53:03] 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


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51176&edit=1


Thread (12 messages)

« previous php.bugs (#148153) next »