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

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

 New Comment:

Will you backport this bugfix to PHP 5.3.2 branch?

Otherwise the behavior will be really odd due to presence of this bug.


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

-Status: Open
+Status: Closed


------------------------------------------------------------------------
[2010-03-02 01:17:06] fel...@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

Reply via email to