Re: Moving json extension to core?
| From: | Sara Golemon | Date: | Wed, 29 Apr 2020 22:45:10 +0000 |
| Subject: | Re: Moving json extension to core? | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109938@lists.php.net to get a copy of this message | ||
On Wed, Apr 29, 2020 at 5:36 PM Benjamin Morel <benjamin.morel@gmail.com>
wrote:
> I want my classes to implement JsonSerializable, but this means requiring
>> ext-json and bumping the library version.
>>
>
> At the risk of derailing... You can have your class implement the
interface unconditionally, then have a polyfill definition in your autoload
for cases where it doesn't exist. Obviously, it won't have an impact on
calls to json_encode(), but if the interface doesn't exist it's because
json_encode() doesn't either, so that should be harmless. :D
-Sara