Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3873 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47599 invoked from network); 13 Aug 2003 06:38:00 -0000 Received: from unknown (HELO bugge.potatoe.com) (216.240.48.15) by pb1.pair.com with SMTP; 13 Aug 2003 06:38:00 -0000 Received: from potatoe.com (localhost [127.0.0.1]) by bugge.potatoe.com (8.12.9/8.12.2) with ESMTP id h7D6ebaF013667; Tue, 12 Aug 2003 23:40:37 -0700 (PDT) Message-ID: <3F39DD65.30401@potatoe.com> Date: Tue, 12 Aug 2003 23:40:37 -0700 Organization: The Madfish Group User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030727 Thunderbird/0.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: call_user_func, static calls, and $this From: tater@potatoe.com (Brad Bulger) this is old subject everyone is tired of i'm sure. but since large changes have been made to call_user_func[_array] recently, i want to confirm: 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 the very last part seems like it *might* be a bug, or it might be a decision - that call_user_func(array('class','function'),$arg) will always force class::function() to behave as if declared statically. that is a bit of a problem for self:: and parent:: but that is ok if it is how it must be. if anyone can say about this, it would be kind. ps - i looked in old mail, sure this had been discussed - topic came up, but nothing for sure, except introduction of 'static' to prevent $this, which solves opposite problem :)