Newsgroups: php.internals,php.internals Path: news.php.net Xref: news.php.net php.internals:38599 php.internals:38600 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85682 invoked from network); 24 Jun 2008 20:01:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jun 2008 20:01:18 -0000 X-Host-Fingerprint: 64.8.134.189 unknown Received: from [64.8.134.189] ([64.8.134.189:24772] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/00-18440-D8151684 for ; Tue, 24 Jun 2008 15:57:01 -0400 To: internals@lists.php.net,Janusz Lewandowski Message-ID: <4861518A.4000007@gmail.com> Date: Tue, 24 Jun 2008 14:56:58 -0500 User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 CC: Stanislav Malyshev , PHP internals References: <485C5081.1050609@zend.com> <485FDBE2.6020409@zend.com> <486122CC.5050303@zend.com> <353f2c6f0806240952n6bcb1c6am47787ab65f837ee2@mail.gmail.com> <486127F2.7030704@zend.com> <353f2c6f0806241014m2b738a6cyf146331620034522@mail.gmail.com> In-Reply-To: <353f2c6f0806241014m2b738a6cyf146331620034522@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 64.8.134.189 Subject: Re: [PHP-DEV] LSB forward_static_call() From: rpanning@gmail.com (Ryan Panning) Janusz Lewandowski wrote: > class A > { > function mA() > { > $this->nA(); > } > > static function mB() > { > self::nB(); > } > } > > class B extends A > { > function mA() > { > parent::mA(); > } > > static function mB() > { > parent::mB(); > } > > function nA() > { > echo 'A'; > } > > function nB() > { > echo 'B'; > } > } > > $obj = new B(); > $obj->mA(); > B::mB(); > ?> > > Most people will think, that it will output AB. But currently in PHP > 5.2 (I don't have PHP 5.3 to test it) it will output: > A > Fatal error: Call to undefined method A::nb() in > Z:\localhost\testLSB.php on line 11 > > User that sees this, doesn't have any idea where is the problem and > how to find some information about it. If I may throw my 2 cents in, if it's even worth anything anyway. This is exactly what I would expect the output to be. If you would want A::mB() to go back to B::nB() I would switch the self::nB() to static::nB(), and have an abstract nB() method declared in A. Is this not how everyone thinks it should be?