Re: New handler for retrieving properties when object is serialized
| From: | Nikita Popov | Date: | Thu, 25 Jul 2013 19:47:51 +0000 |
| Subject: | Re: New handler for retrieving properties when object is serialized | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-68308@lists.php.net to get a copy of this message | ||
On Thu, Jul 25, 2013 at 9:09 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
> Hi!
>
> > It's useful in situation if you only need to change properties for
> > serialization. It's very similar to get_debug_info that is used only in
> > specific situations (print_r...)
>
> Isn't __sleep already doing this?
>
__sleep returns an array of object property *names* to be serialized. Using
__sleep you can restrict the set of serialized properties, but the
properties still need to exist.
Nikita