Re: RFC: Property get/set syntax
| From: | Stas Malyshev | Date: | Sun, 22 Apr 2012 03:33:20 +0000 |
| Subject: | Re: RFC: Property get/set syntax | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60255@lists.php.net to get a copy of this message | ||
Hi!
> empty() - Returns true for a property retrieved via __get() or via a
> getter -- Any idea why this would be the case for __get()? Is this a
> bug?
isset() calls __isset(), empty() calls __isset() and __get(). I'm not
sure what exactly you consider to be a bug.
> unset() - Would unset a temporary variable (the one returned by the
> getter) -- see previous email re: adding unset/isset property
> functions.
unset() calls __unset().
> sort() - Does the same thing as with __get()/__set() which is to say,
> the array is sorted but the property is not updated with the value.
> Should accessor behave differently than the magic methods? Should
> this just be documents or should this be fixed?
sort() works just fine if you define __get to return by-ref.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227