Hi, Am 23.03.2015 um 06:21 schrieb Stanislav Malyshev: > 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?
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 language features (closures, anonymous classes) which makes it more and more dangerous to serialize something that could contain any of these (or any of a number of non-serializable internal classes: mysqli/pdo, etc.) If we don't want serialization as a first-class operation, we should 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. Greets Dennis -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php