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 set

This 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


-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to