Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118501 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62130 invoked from network); 26 Aug 2022 10:02:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Aug 2022 10:02:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 017DC180544 for ; Fri, 26 Aug 2022 03:02:29 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 26 Aug 2022 03:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1661508145; bh=tA9tQq0g9KqUxSC8peu+HtoH5iuIFS00cQCMOUH1aeY=; h=Date:Subject:To:References:From:In-Reply-To:From; b=gjwz2E4nYavyQs35hlXqgXXHphb9X5WuH8Gb6UTmfssHnAPVxgi89iQ5pUz3cA7N7 kohk83gzQ6ezrRsZyf5tCPZpNcvudz/aWd/ha0CjCLYQYGlyQCZFnzZYvJuNfpKu12 Zj8/5HxXytlhIYL/3GNMYJY9PNpLeFKvlYULMwShleny3fqsbIkzJzJe44+eVXusCT vumtT2VOIkR/31oEYgLCV9Y3T491zaW5fiJmP/R/gsBBHdWdDe5zvroo3PD3MGLBuq gSVSdEXqOqBaXYFniGplxwxZbWYXlImX6eNoEooK++L9CSF9JfFahCr08m0FKfIVaz N8pQtNTUlEk+A== Message-ID: <6c8090ad-1a20-e636-f688-7f8b2863b026@bastelstu.be> Date: Fri, 26 Aug 2022 12:02:24 +0200 MIME-Version: 1.0 Content-Language: en-US To: Paul Crovella , internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC json_validate() - status: Under Discussion From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) 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