Re: [RFC] Property Accessors 1.2 : Shadowing

From: Date: Sun, 28 Oct 2012 16:05:22 +0000
Subject: Re: [RFC] Property Accessors 1.2 : Shadowing
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-63693@lists.php.net to get a copy of this message
Well I guess this and many of the other issues from other threads are the reasons I had it written the way that it is currently (basically an extension of __get()) but numerous other proposals have muddied the situation. On Sunday, October 28, 2012 2:17:47 AM, Stas Malyshev wrote:
Hi!
Sorry I guess I should have been more clear. The recursion would prevent the accessor from being called which would allow the ordinary property code to execute, thus accessing the property directly. I
This could lead to weird scenarios where the same $foo->bar in random function could call or not call an accessor depending on the stack trace (provided that accessors call out to other functions - which is not frequent but can definitely happen). In case of __get it's harmless since we know $foo->bar doesn't exist anyway, but if we do allow $bar to exist in $foo it might get weird. I'd certainly appreciate some notice/E_STRICT if this happens. Maybe I'd go even as far as issuing E_STRICT on having both $bar and any of the accessors for $bar in the same class - but this of course would scream on the scenario of augmenting existing $bar with accessors - which is legit, unless it gets weird as described above.
-- -Clint

« previous php.internals (#63693) next »