Re: RFC json_validate() - status: Under Discussion

From: Date: Fri, 26 Aug 2022 10:02:24 +0000
Subject: Re: RFC json_validate() - status: Under Discussion
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-118501@lists.php.net to get a copy of this message
Hi On 8/26/22 10:56, Paul Crovella wrote:
I'm for this as well. Though something more than a boolean is useful to indicate when the max depth has been exceeded as that's not strictly a problem with the json's validity.
Yes, it's not strictly invalid JSON, but I expect json_validate() to be used as a check to mean "will json_decode() be able to decode the JSON with these parameters". Then false is the logical result when exceeding the depth. Also json_last_error() will do what you expect it to do: https://github.com/php/php-src/pull/9399/files#diff-1cdb6c7eb68aa60b323b056a06d6f7427b38e9d8d967ce97992129ff65c7951eR55. So you can find out the reason why the JSON is invalid. Best regards Tim Düsterhus

« previous php.internals (#118501) next »