Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56689 invoked from network); 10 Aug 2011 22:24:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2011 22:24:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:33595] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/D9-00852-405034E4 for ; Wed, 10 Aug 2011 18:24:05 -0400 Received: by bkd19 with SMTP id 19so587955bkd.29 for ; Wed, 10 Aug 2011 15:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kI0OjV+oLPS3UUEmV/LCLi38AloMWTtyudXdwjIWf2Y=; b=HWn893kcp9bNIUJ8YuIhm1/ezKOb2Fy4m4heu23bLncH1Q6VCIHG9ZFagZ3XwdEmKJ V4m2MytPDt8eeoON4cJgQsvyHXqxURo3sueUM6El77fTH97JHklesEh1nT6U796ZYzdF XkIbVD+LNJ++uMKV+Vj+0sWDdp0hMbkMYZpBE= MIME-Version: 1.0 Received: by 10.204.14.88 with SMTP id f24mr2600747bka.278.1313015041840; Wed, 10 Aug 2011 15:24:01 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.50.199 with HTTP; Wed, 10 Aug 2011 15:24:01 -0700 (PDT) In-Reply-To: <4E42E81B.9090200@sugarcrm.com> References: <4E42E639.5020604@php.net> <4E42E81B.9090200@sugarcrm.com> Date: Thu, 11 Aug 2011 00:24:01 +0200 X-Google-Sender-Auth: FPtIr2ql4eGeDS92RNECdJyFqik Message-ID: To: Stas Malyshev Cc: Sebastian Bergmann , "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Static method call syntax on objects From: colder@php.net (Etienne Kneuss) Hello, On Wed, Aug 10, 2011 at 22:20, Stas Malyshev wrote= : > Hi! > > On 8/10/11 1:12 PM, Sebastian Bergmann wrote: >> >> =C2=A0 Is this exepcted behaviour? >> >> =C2=A0 =C2=A0 =E2=9E=9C =C2=A0~ =C2=A0cat test.php >> =C2=A0 =C2=A0 > =C2=A0 =C2=A0 class Foo { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 public static function bar() { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print __METHOD__ . "\n"; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> =C2=A0 =C2=A0 } >> >> =C2=A0 =C2=A0 $foo =3D new Foo; >> =C2=A0 =C2=A0 $foo::bar(); >> >> >> =C2=A0 =C2=A0 =E2=9E=9C =C2=A0~ =C2=A0php test.php >> =C2=A0 =C2=A0 Foo::bar >> >> =C2=A0 I, for one, was surprised that this does what it does with PHP 5.= 3 and >> =C2=A0 PHP 5.4 (do not have older version of PHP hand). >> > > This is how FETCH_CLASS works now - when it has an object in where it > expects class name, it uses object's class. We could call toString() inst= ead > but that might be even more surprising. Well, FETCH_CLASS has always worked like that, but previously (<5.3) variables for class references were only allowed as part of the "new" statement, e.g. new $obj; The semantic remains the same, only that now variables are also allowed for :: calls (since 5.3). > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch