Re: Serializing exceptions
| From: | Stanislav Malyshev | Date: | Mon, 23 Mar 2015 06:43:47 +0000 |
| Subject: | Re: Serializing exceptions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85421@lists.php.net to get a copy of this message | ||
Hi!
> I think we should discuss if (un)serialization is a first-class
> operation in the language and if so, we should try to make everything
> serializable. Currently, we introduce more and more unserializable
I don't think we can, not unless we can serialize PHP code (like Java
can have JARs with bytecode). Otherwise, something like closure is
inherently not serializable. Moreover, something resource-bound is not
serializable either since it depends on something external.
> If we don't want serialization as a first-class operation, we should
I'm not sure what you mean by "first-class operation". We certainly want
most objects be serializable, and they are. But some are not, and would
never be. The question is - is Exception one of those? I think yes, but
I'd like to hear if somebody says otherwise.
> make objects not serializable by default unless they implement
> serializable or __sleep()/__wakeup() and add an is_serializable() method
> to check if an object is serializable. But currently serialization gets
> more and more unreliable/prone to runtime errors.
That's because implementers of classes are not careful to account for
serialization. However, I don't think we need any drastic changes here.
--
Stas Malyshev
smalyshev@gmail.com