Re: RFC Idea - is_json - looking for feedback
| From: | Dusk | Date: | Sat, 30 Jul 2022 06:29:53 +0000 |
| Subject: | Re: RFC Idea - is_json - looking for feedback | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118317@lists.php.net to get a copy of this message | ||
On Jul 29, 2022, at 23:05, Aleksander Machniak <alec@alec.pl> wrote:
> json_decode() has $depth argument, I think is_json() probably also should. And I'm not
> sure about JSON_INVALID_UTF8_IGNORE flag.
>
> My point is that if you use these with json_decode() you might also need to use these with
> is_json()
How about if validation were a flag to json_decode() -- perhaps JSON_VALIDATE_ONLY -- which made it
return a placeholder value like true instead of the decoded structure? (It can't return null on
success; that's used for errors if JSON_THROW_ON_ERROR isn't set.)