Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3877 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17536 invoked from network); 13 Aug 2003 08:36:52 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 13 Aug 2003 08:36:52 -0000 Received: (qmail 3347 invoked from network); 13 Aug 2003 08:36:43 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 13 Aug 2003 08:36:43 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20030813113535.027ceb78@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 13 Aug 2003 11:37:52 +0300 To: Brad Bulger Cc: internals@lists.php.net In-Reply-To: <3F39DD65.30401@potatoe.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] call_user_func, static calls, and $this From: zeev@zend.com (Zeev Suraski) References: <3F39DD65.30401@potatoe.com> 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