Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54144 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86883 invoked from network); 22 Jul 2011 17:01:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jul 2011 17:01:24 -0000 Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:56511] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/93-03772-2ECA92E4 for ; Fri, 22 Jul 2011 13:01:23 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 2458D5CFD; Fri, 22 Jul 2011 13:01:20 -0400 (EDT) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ylwHtmEk+6fV; Fri, 22 Jul 2011 13:01:19 -0400 (EDT) Received: from djbondc (modemcable053.81-59-74.mc.videotron.ca [74.59.81.53]) by mail.ca.gdesolutions.com (Postfix) with ESMTPSA id 097FD5C4B; Fri, 22 Jul 2011 13:01:18 -0400 (EDT) To: "'Alex Howansky'" , References: <4E29949C.9020209@gmail.com> In-Reply-To: <4E29949C.9020209@gmail.com> Date: Fri, 22 Jul 2011 13:01:18 -0400 Message-ID: <004701cc4890$f9d63f80$ed82be80$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcxIgqPr38th6oTRTYKrt/PbLqQEjQACYpGQ Content-Language: en-ca Subject: RE: [PHP-DEV] 5.4a2 trait attribute name conflict resolution From: jbondc@openmv.com ("Jonathan Bond-Caron") On Fri Jul 22 11:17 AM, Alex Howansky wrote: > trait foo > { > public $zoo = 'foo::zoo'; > public function bar() > { > echo "in foo::bar\n"; > } > } > > class baz > { > use foo; > public $zoo = 'baz::zoo'; > public function bar() > { > echo "in baz::bar\n"; > } > } > > $obj = new baz(); > $obj->bar(); > echo $obj->zoo, "\n"; > > We get: > > in baz::bar > foo::zoo > > It seems this is not correct and that it should be: > > in baz::bar > baz::zoo > The expected behavior is an E_STRICT notice: http://svn.php.net/viewvc/php/php-src/trunk/Zend/tests/traits/property001.ph pt?view=markup&pathrev=306476 If the modifier is different/conflicting (public, protected, private) E_FATAL http://svn.php.net/viewvc?view=revision&revision=306476 http://marc.info/?l=php-internals&m=129251322332367&w=2 The theory is traits should not have conflicting state/properties. Best practice, always choose trait property names carefully/~unique so that you don't run into conflicts. The short answer is it's not a bug but maybe an implementation issue... should it be an E_WARNING instead of E_STRICT?