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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to