Edit report at http://bugs.php.net/bug.php?id=51176&edit=1
ID: 51176
Comment by: david71rj at gmail dot com
Reported by: majkl578 at gmail dot com
Summary: Static calling in non-static method behaves like
$this->
Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Irrelevant
PHP Version: 5.3.2RC3
Assigned To: felipe
Block user comment: N
Private report: N
New Comment:
Sorry by realive this topic, but I really think that it is a bug.
If I want call "bar" with context, the correct mean is $this->bar().
Else, the
"static" sounds for me like "call without context". I'm wrong?
Please, read this topic to understand what I'm saying:
http://stackoverflow.com/questions/6181603/php-is-handling-incorrectly-my-static-
call
Previous Comments:
------------------------------------------------------------------------
[2010-11-03 12:03:17] majkl578 at gmail dot com
You cannot call foo::start(), because the method is non-static and
therefore it does not make sense.
Also, self, static and class name are used to call methods statically,
not in a object context.
For calling method bar in object context, I think '$this->' should be
used instead.
Obviously parent should not behave this way and respect context, but I
think it should be the only exception (as shown in #52713).
------------------------------------------------------------------------
[2010-11-03 02:45:23] [email protected]
Hello, I've reverted the wrong changes introduced by trying to fix the
issue reported, but actually there is no bug at all. self::bar(),
static::bar() and foo::bar() are being called in an object context,
hence the __call() is called.
I.e.
$foo->start(); // invoke the __call method
foo::start(); // invoke the __callStatic method
Thanks.
------------------------------------------------------------------------
[2010-11-03 02:35:28] [email protected]
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=305043
Log: - Reverted fix for bug #51176
------------------------------------------------------------------------
[2010-03-04 14:27:55] [email protected]
Hello!
This isn't my decision, but the release manager.
Thanks.
------------------------------------------------------------------------
[2010-03-04 12:33:59] majkl578 at gmail dot com
Can you explain me, please, why this is not fixed in 5.3.2 stable?
"Thank you for the report, and for helping us make PHP better."
You are intentionally making PHP worse!
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=51176
--
Edit this bug report at http://bugs.php.net/bug.php?id=51176&edit=1