Maybe you can implement the __sleep method and just return the documented
attributes (message, code, file, line).

Not perfect, but probably more useful than throw an exception, specially if
the exception is something that is the attribute of some object that is
being serialized.

Juan Basso
On Mar 23, 2015 1:22 AM, "Stanislav Malyshev" <smalys...@gmail.com> wrote:

> Hi!
>
> Looking into some issue, I've discovered that, to my surprise,
> Exceptions are serializable. Except that it doesn't always work of
> course (e.g. see http://stackoverflow.com/q/9747813/214196) because
> exceptions contain backtraces, and those can contain non-serializable
> objects. So in reality, you never know if you can serialize it or not.
>
> So, I wonder - would it be ok to make exceptions not serializable at
> all? I think that would prevent major WTF factor when people try it and
> it randomly fails.
>
> Thoughts?
> --
> Stas Malyshev
> smalys...@gmail.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to