Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10751 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35550 invoked by uid 1010); 24 Jun 2004 11:10:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35526 invoked from network); 24 Jun 2004 11:10:10 -0000 Received: from unknown (HELO lakermmtao03.cox.net) (68.230.240.36) by pb1.pair.com with SMTP; 24 Jun 2004 11:10:10 -0000 Received: from [192.168.3.100] (really [68.98.128.109]) by lakermmtao03.cox.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20040624111009.MHPX3786.lakermmtao03.cox.net@[192.168.3.100]>; Thu, 24 Jun 2004 07:10:09 -0400 Message-ID: <40DAB693.8080200@velum.net> Date: Thu, 24 Jun 2004 07:10:11 -0400 User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alan Knowles CC: internals@lists.php.net References: <40DA29C3.1090301@velum.net> <20040624074757.1883.qmail@pb1.pair.com> <40DA8B0A.6070609@akbkhome.com> In-Reply-To: <40DA8B0A.6070609@akbkhome.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: static/object method From: hans@velum.net (Hans Lellelid) Alan Knowles wrote: > the E_STRICT warnings on static calls to non static methods are probably > usefull, (as $this could be defined totally randomly), so it does make > some sense.. > > btw: does that mean: > > class a { function find() { } } > class b extends a { function find() { } } > > // call the toplevel parent method.. (skip the imediate parent) > class c extends b { function find() { a::find() } } > $a = new c; > $c->find(); > > illicits and E_STRICT warning??? Hmm --yes unless you declare a::find() as a 'static' method. The good news is that static methods can be used on objects w/ no errors (so you can definitely accomplish that design, but would just have to declare methods as 'static'). So, basically: - if you try to call a "normal" method statically you will get E_STRICT notice - if you make any reference to $this in a 'static' method you will get E_FATAL error (Correct me if I'm missing anything) Hans