Bug #51524 [Bgs->Opn]: Class static method confusion
| From: | pajoye@php.net | Date: | Sat, 10 Apr 2010 16:06:02 +0000 |
| Subject: | Bug #51524 [Bgs->Opn]: Class static method confusion | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149476@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: pajoye@php.net
Reported by: david71rj at gmail dot com
Summary: Class static method confusion
-Status: Bogus
+Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 7/64
PHP Version: 5.3.2
New Comment:
Not sure you can simply bogus it "because that's the way php4 works" :)
Should we not fix it in trunk instead? Or at least leave that request
open until we have a decision.
Previous Comments:
------------------------------------------------------------------------
[2010-04-10 17:49:31] johannes@php.net
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.
------------------------------------------------------------------------
[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