Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33440 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15010 invoked by uid 1010); 26 Nov 2007 13:30:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 14995 invoked from network); 26 Nov 2007 13:30:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2007 13:30:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=dz@bitxtender.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dz@bitxtender.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain bitxtender.com from 80.237.132.12 cause and error) X-PHP-List-Original-Sender: dz@bitxtender.com X-Host-Fingerprint: 80.237.132.12 wp005.webpack.hosteurope.de Received: from [80.237.132.12] ([80.237.132.12:47504] helo=wp005.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/50-11717-C5ACA474 for ; Mon, 26 Nov 2007 08:30:05 -0500 Received: from dslb-084-056-052-227.pools.arcor-ip.net ([84.56.52.227] helo=localhost); authenticated by wp005.webpack.hosteurope.de running ExIM using esmtpsa (TLSv1:RC4-SHA:128) id 1Iwe2C-0002TZ-S3; Mon, 26 Nov 2007 14:30:00 +0100 To: "Alexey Zakhlestin" In-Reply-To: References: <4740C654.3020302@digitalsandwich.com> <47417C65.8010708@iamjochem.com> <474130B3.9070303@digitalsandwich.com> <4741DC81.6000506@zend.com> <4741D574.2020800@digitalsandwich.com> <474247A2.5050301@zend.com> <4741D9D1.6030106@digitalsandwich.com> <47424B4F.2@zend.com> <4743CED7.5050402@avalon.aut.bme.hu> <4749F328.8080506@digitalsandwich.com> Message-ID: <45B2C652-820A-4820-82C5-A156DB5721DD@bitxtender.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v915) Date: Mon, 26 Nov 2007 14:30:00 +0100 Cc: "Mike Lively" , "PHP Developers Mailing List" X-Mailer: Apple Mail (2.915) X-bounce-key: webpack.hosteurope.de;dz@bitxtender.com;1196083804;ea182747; Subject: Re: [PHP-DEV] [PATCH] late binding for parent (and other options) - Was Re: [PHP-DEV] late static binding php6 From: dz@bitxtender.com (=?ISO-8859-1?Q?David_Z=FClke?=) Am 26.11.2007 um 10:24 schrieb Alexey Zakhlestin: > On 11/26/07, Mike Lively wrote: >> class A { >> public static function test() { >> echo get_called_class()."\n"; >> } >> } >> >> class B extends A { >> public static function test() { >> parent::test(); >> } >> } >> >> A::test(); >> B::test(); >> >> will output: >> A >> B > I believe this first patch is the proper way to go. It feels > "natural", "intuitive", etc. Definitely. However, given the arguments here, I was thinking this: - static always points to the original callee, w/o being "broken" by parent:: - get_called_class() should _not_ behave like shown above. It really was not B that got called, but it was A, trough parent:: - a new get_static_class() method should return "B". (essentially, get_called_class() returns the name of "self", while get_static_class() returns the name of "static"). So: class A { public static function test() { echo get_called_class() . get_static_class(); } } class B extends A { public static function test() { parent::test(); } } outputs: AAAB - David