Re: [RFC] Property Accessors 1.2 : Shadowing
| From: | Stas Malyshev | Date: | Sun, 28 Oct 2012 07:17:47 +0000 |
| Subject: | Re: [RFC] Property Accessors 1.2 : Shadowing | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63687@lists.php.net to get a copy of this message | ||
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.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227