Re: RFC: Deprecate json_encode() on classes marked as non-serializable
| From: | John Coggeshall | Date: | Thu, 05 Sep 2024 16:03:36 +0000 |
| Subject: | Re: RFC: Deprecate json_encode() on classes marked as non-serializable | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125438@lists.php.net to get a copy of this message | ||
> 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.
I would suggest we take a step back from this and look at it with a bit more of a wider lens. It
seems to me that this would be a good place to have an attribute (e.g. #[NotSerializable] ) that
could be defined for any class (with ZEND_ACC_NOT_SERIALIZABLE being automatically given this
attribute)? It just seems to be a more holistic approach that makes sense, rather than basing it on
internal engine stuff and/or limiting it to internal objects.
Coogle