Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54499 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25598 invoked from network); 10 Aug 2011 20:20:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Aug 2011 20:20:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 207.97.245.143 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 207.97.245.143 smtp143.iad.emailsrvr.com Linux 2.6 Received: from [207.97.245.143] ([207.97.245.143:55395] helo=smtp143.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/B3-00852-F18E24E4 for ; Wed, 10 Aug 2011 16:20:47 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp34.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id CCE6C380236; Wed, 10 Aug 2011 16:20:44 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp34.relay.iad1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 7B5F03801D4; Wed, 10 Aug 2011 16:20:44 -0400 (EDT) Message-ID: <4E42E81B.9090200@sugarcrm.com> Date: Wed, 10 Aug 2011 13:20:43 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Sebastian Bergmann CC: "internals@lists.php.net" References: <4E42E639.5020604@php.net> In-Reply-To: <4E42E639.5020604@php.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Static method call syntax on objects From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! On 8/10/11 1:12 PM, Sebastian Bergmann wrote: > Is this exepcted behaviour? > > ➜ ~ cat test.php > class Foo { > public static function bar() { > print __METHOD__ . "\n"; > } > } > > $foo = new Foo; > $foo::bar(); > > > ➜ ~ php test.php > Foo::bar > > I, for one, was surprised that this does what it does with PHP 5.3 and > 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() instead but that might be even more surprising. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227