Hello,

As per my previous email to the list, I have now created the official RFC
to deprecate calling json_serialize() on instances of classes marked with
ZEND_ACC_NOT_SERIALIZABLE.

https://wiki.php.net/rfc/deprecate-json_encode-nonserializable

I have also created a PR with the implementation here:

https://github.com/php/php-src/pull/15724

I have considered other options, both constraining the implementation to
just Generator and/or to add special cases for Generator (and maybe
Iterator), but they either continue to keep the asymmetry between
serialize() and json_encode() and/or are making things even more
inconsistent.

Please tell me what you think, especially, if you agree that
blanked-deprecating all of ZEND_ACC_NOT_SERIALIZABLE classes is acceptable
BC-wise (after a bit of deliberation over the weekend, I think it is and
most json-serializations of such marked classes are probably unintentional).

Thanks in advance for all comments

Philip

Reply via email to