ID: 48714
User updated by: sebcorne at gmail dot com
Reported By: sebcorne at gmail dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows
PHP Version: 5.3.0RC4
New Comment:
Thanks for the explications.
You can close this report
Previous Comments:
------------------------------------------------------------------------
[2009-07-24 09:44:09] colder@php.net
> I see two problems :> - self class respond> - "__call()" is called instead of "__callstatic()"
That is because the call is not static. $name::method() is not
sufficient to garantee a static call:
- the target method has to be static or
- the current scope has to be void
In your case, the definition of the target method is not explicit, as
test() is not defined and you have both __call and __callStatic. Since
the current scope exists, it will use __call by default.
------------------------------------------------------------------------
[2009-07-24 09:29:16] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
------------------------------------------------------------------------
[2009-06-30 17:12:14] sebcorne at gmail dot com
Yes, it's documented :
"it might give unexpected results in so-called edge cases"
I see two problems :
- self class respond
- "__call()" is called instead of "__callstatic()"
There is not means to solve that ?
------------------------------------------------------------------------
[2009-06-30 14:05:51] sjoerd-php at linuxonly dot nl
Thank you for your bug report.
Are you sure the behavior you describes is not documented? Please take
a look at:
http://nl.php.net/manual/en/language.oop5.late-static-bindings.php#language.oop5.late-static-bindings.edge-cases
------------------------------------------------------------------------
[2009-06-30 05:45:29] sebcorne at gmail dot com
class base
{
static public function __callstatic($name, $arguments)
{
echo get_called_class() . "::$name() is called \n\n";
}
public function __call($name, $arguments)
{
echo get_called_class() . "->$name() is called \n\n";
}
}
give the same result.
but without "__call()", it's ok.
if "$this" exists in inheritance, "__call()" (of $this) is called
instead of "__callstatic()"
------------------------------------------------------------------------
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/48714--
Edit this bug report at http://bugs.php.net/?id=48714&edit=1