Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10255 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37462 invoked by uid 1010); 3 Jun 2004 08:01:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37392 invoked from network); 3 Jun 2004 08:01:24 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 3 Jun 2004 08:01:24 -0000 Received: (qmail 2726 invoked from network); 3 Jun 2004 08:01:13 -0000 Received: from int.zend.com (HELO AndiNotebook.zend.com) (10.1.1.1) by int.zend.com with SMTP; 3 Jun 2004 08:01:13 -0000 Message-ID: <5.1.0.14.2.20040603110036.02f28760@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 03 Jun 2004 11:01:15 +0300 To: Bert Slagter ,internals@lists.php.net In-Reply-To: <20040601131122.36657.qmail@pb1.pair.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Use of 'self' in static function in subclass From: andi@zend.com (Andi Gutmans) References: <20040601131122.36657.qmail@pb1.pair.com> I don't agree as I don't think static methods should be virtual. This is what $this-> exists for. Re-design...! Andi At 03:11 PM 6/1/2004 +0200, Bert Slagter wrote: >Hi All, > >I have a class and a subclass, both with a static method: > >class Foo >{ > static function Bar() > { > self::Baz(); > } >} > >class Foo2 extends Foo >{ > static function Baz() > { > echo 'Baz'; > } >} > >Foo2::Bar(); >?> > >In this case I expect to find 'Baz' on my screen, but I get the following: >"Fatal error: Call to undefined method Foo::baz() in >d:\htdocs_php5\ProBase2\TRUNK\probase\libsys\test5.php on line 7". > >This is in PHP5 RC2. > >Somehow this behaviour seems logical, on the other hand I don't think it's >desired. I think that 'self' should point to the current class, even if >the static method resides in a parent class. > >Is this 'self'-behaviour intended? > >Bert > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php