Re: call_user_func, static calls, and $this
| From: | Zeev Suraski | Date: | Wed, 13 Aug 2003 08:37:52 +0000 |
| Subject: | Re: call_user_func, static calls, and $this | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3877@lists.php.net to get a copy of this message | ||
At 09:40 13/08/2003, Brad Bulger wrote:
if an object calls one of its methods ($thing->foo()), any static-type method calls made inside there - self::a(), parent::a(), fezbar::a() - will have $this defined, pointing to original calling object. self:: and parent:: are always relative to the containing class, regardless of this. two exceptions: - the method is declared as 'static'; if so, $this is never set - the method is called via call_user_func or call_user_func_array; if so, $this is not setThis should be fixed. $this should be visible for methods invoked through call_user_function(). And you're absolutely right about your analysis of the :: operator. Contrary to popular belief it was NOT introduced for static function calls, but rather, for being able to invoke methods of parent classes (a much more common use for the :: operator in other languages too). Zeev