Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64490 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53953 invoked from network); 3 Jan 2013 00:28:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2013 00:28:47 -0000 Authentication-Results: pb1.pair.com header.from=steve@mrclay.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=steve@mrclay.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mrclay.org from 50.22.11.19 cause and error) X-PHP-List-Original-Sender: steve@mrclay.org X-Host-Fingerprint: 50.22.11.19 bedford.accountservergroup.com Linux 2.6 Received: from [50.22.11.19] ([50.22.11.19:41516] helo=bedford.accountservergroup.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/F0-35624-EB0D4E05 for ; Wed, 02 Jan 2013 19:28:47 -0500 Received: from ip68-101-74-66.ga.at.cox.net ([68.101.74.66]:50305 helo=[192.168.11.20]) by bedford.accountservergroup.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1TqYfr-000Aty-Gi; Wed, 02 Jan 2013 18:28:43 -0600 Message-ID: <50E4D0BB.7060701@mrclay.org> Date: Wed, 02 Jan 2013 19:28:43 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Clint Priest , PHP Internals References: <50E41BB6.4030901@zerocue.com> <50E4A43E.6030302@zerocue.com> <50E4B232.5000505@mrclay.org> <50E4BDDE.8050509@zerocue.com> In-Reply-To: <50E4BDDE.8050509@zerocue.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bedford.accountservergroup.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - mrclay.org Subject: Re: [PHP-DEV] [PHP-RFC] Property Accessors 1.2 for Final Review before Vote From: steve@mrclay.org (Steve Clay) On 1/2/13 6:08 PM, Clint Priest wrote: > Sorry, there was a typo in that RFC there, this line: > isset { return $this->Hours != NULL; } > Should have been with !==: > isset { return $this->Hours !== NULL; } > > I've already updated the 1.2 doc to reflect the correct way. > > Given what I mentioned above, I'm assuming you did not test this with the fork, right? > Just based your comments on how it should logically work (with the incorrect != vs !==?) I haven't tested the fork. I just borrowed your logic with the typo :) > One last thing about that, the isset/unset with $this->Hours calls the getter to retrieve > the $this->Hours value, so it behaves as your example below indicates. The RFC says, "only the accessors themselves may directly access the shadowed property." I read that as: Within get, $this->Hours is the raw shadowed property. Within set, $this->Hours is the raw shadowed property. Within isset, $this->Hours is the raw shadowed property. Within unset, $this->Hours is the raw shadowed property. But you seem to imply: Within get, $this->Hours is the raw shadowed property. Within set, $this->Hours is the raw shadowed property. Within isset, $this->Hours is accessed via __getHours()/__setHours(). Within unset, $this->Hours is accessed via __getHours()/__setHours(). So really the default implementations behave like this: isset { return $this->__getHours() !== NULL; } unset { $this->__setHours(NULL); } I think the RFC should be much clearer about what property access actually means within each accessor method, as I expect users to be very surprised by this behavior. This is also looks like it could lead to surprises: Within get, $this->Hours is the raw shadowed property. Within get, parent::$Hours is accessed via parent::__getHours()/parent::__setHours(). Also, is there no way to access the shadow property within isset/unset? If not, is there a good reason to not allow it? Also, do/should multiple property accessors interact? Consider: class Foo { public $a { get { $this->a = 1; return 2; } } public $b { get { return $this->a; } } } $foo = new Foo; $foo->a; // 2 (but shadowed property is 1) $foo->b; // 1 or 2? Steve Clay -- http://www.mrclay.org/