Bug #51524 [Opn->Bgs]: Class static method confusion
| From: | johannes@php.net | Date: | Sat, 10 Apr 2010 15:49:31 +0000 |
| Subject: | Bug #51524 [Opn->Bgs]: Class static method confusion | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149474@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51524&edit=1
ID: 51524
Updated by: johannes@php.net
Reported by: david71rj at gmail dot com
Summary: Class static method confusion
-Status: Open
+Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 7/64
PHP Version: 5.3.2
New Comment:
If a static method is called from an object context the callers $this is
sent. This i due to compatibility with the way PHP 4 worked.
Previous Comments:
------------------------------------------------------------------------
[2010-04-10 03:37:23] david71rj at gmail dot com
Description:
------------
If I use public method as static in a method of a second function, this
send $this
from second class, don't of the first.
Test script:
---------------
http://codepad.org/8hW4Qtbo
Expected result:
----------------
array
0 => string 'static' (length=6)
1 => int 1
array
0 => string 'object' (length=6)
1 =>
object(test)[2]
2 => int 1
array
0 => string 'static' (length=6)
1 => int 1
array
0 => string 'object' (length=6)
1 =>
object(test)[3] <<<<<<<<<<<<<<< OKAY
2 => int 1
Actual result:
--------------
array
0 => string 'static' (length=6)
1 => int 1
array
0 => string 'object' (length=6)
1 =>
object(test)[2]
2 => int 1
array
0 => string 'static' (length=6)
1 => int 1
array
0 => string 'object' (length=6)
1 =>
object(test2)[3] <<<<<<<<< WHY "test2" IF DON'T?
2 => int 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51524&edit=1