I\'m havinh a problem on PHP 5.3. I need to call a method by using __callStatic, but if I use it in a instancied object, PHP call __call instead.>
Good news
I make a BIG work arround, but it works pretty fine. This is the code:
class NoContext {
public static function call($callback, $args = null){
return call_user_func_array($callback, $args ?: array());
}
}
You need to call NoContext::call (statically) like you call call_user_func or similar. It will to remove the $this context. I still thinks that it is a PHP bug, but...
To solve my problem, I do:
class B extends A {
function useCallStatic(){
NoContext::call('A::foo');
}
}
And it will prints: Fine!.
Thanks everybody that help me. I really learn too much with your replies and I wait that my tips be userful sometime to you.