Re: json_encode() and Generators / RFC Karma
| From: | Philip Hofstetter | Date: | Fri, 30 Aug 2024 10:21:14 +0000 |
| Subject: | Re: json_encode() and Generators / RFC Karma | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125359@lists.php.net to get a copy of this message | ||
Hi John,
On Aug 30, 2024 at 09:42:05, John Coggeshall <john@coggenterprises.com>
wrote:
> This seems entirely reasonable and I would welcome an RFC for it (unless
> someone has a better idea as to how to handle this case).
>
>
The other options I considered were to either materialize the Generator,
but given that they can run indefinitely this seems very dangerous or
json-encoding them as [] but that would be lying in most cases, so doing
what serialize() does felt like the only sensible option and would prevent
a nasty case of silent failure.
Regards
Philip