Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118365 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74855 invoked from network); 7 Aug 2022 10:02:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Aug 2022 10:02:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 45F2A180003 for ; Sun, 7 Aug 2022 05:03:24 -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=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 7 Aug 2022 05:03:24 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DA0865C008D for ; Sun, 7 Aug 2022 08:03:23 -0400 (EDT) Received: from imap44 ([10.202.2.94]) by compute2.internal (MEProxy); Sun, 07 Aug 2022 08:03:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ollie.codes; h= cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm1; t=1659873803; x=1659960203; bh=2LTgWlA5nA 9+FZSTlJOaBXEW5AGMcr1ToICGFwolydQ=; b=J/HHwL9ZNLJ3SQr3qNBfFctrex eKOSAvZV6hESQyOWsoVGLZBRa5+vCNwFlVrBRQLGYAzOTy30kDS4c8ohXlA44sJN a0IlQqAwnnJZgCi2tYXQUE3NNvjiAuoDvc2lSLgYG3pXytY55HD8rIeu5RBcc8/4 BKuJhxah/8DdadgrG6F0/C0t+qzvy5mP7icVhpPxy6p0hxNNog4+E+RbKy+cbI14 N4nJf/IFw8SyHLu5eoiugBvEkJmpTOPoXkvEJP4vnnu71UUIhaKz9T8b+Q3RdhfX I2d9yPuof3v9jwK6+i/L5Hncw50dpsoH4u9e61VkWWJJ6mmc5Owb1qeCEOTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1659873803; x=1659960203; bh=2LTgWlA5nA9+FZSTlJOaBXEW5AGM cr1ToICGFwolydQ=; b=RiJpn+Y15ZzAWJlHto2zdcoeDC8uPAG4FUrt72YT1k9k 1f1omw/CSIb92GmwUaoplekKdsiYvJpXIpVeI0VDEHWg9uOnw1SBr5MRYTyy9Pac FldI+8fwYOZ/3rPRasXAMuLLCMkBXOQyED8cuMfKlEeuKyJNlbPLsiTF3Xuabzrk QjgtoRIuu4fGTvIoyMRNKU+RZFBUh0cAO446DszHdawrRuROmi6yzbpKwz9sVPNp kPT6jNczAJIIpdcZPW00YvSY5QwGiOheMx3vUG0ik9wipk48iiBVZzWQHCLGLfke a2jgBGeXLhzqxKMF0J2OMGxLTZkJCwZRGKsDoHg5Aw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefiedggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerredtnecuhfhrohhmpedfqfhllhhivgcutfgvrggufdcuoehphhhpseholhhlihgv rdgtohguvghsqeenucggtffrrghtthgvrhhnpedvtdejgfetleeuleevkedvveeuudekfe fgheetueejvdduffejffdvuddvgeelueenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpehphhhpseholhhlihgvrdgtohguvghs X-ME-Proxy: Feedback-ID: i835c46d5:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 8AA1F36A0071; Sun, 7 Aug 2022 08:03:23 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-758-ge0d20a54e1-fm-20220729.001-ge0d20a54 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Sun, 07 Aug 2022 13:02:40 +0100 To: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= Content-Type: multipart/alternative; boundary=5db90591ae7247aca92cd831bb3f3224 Subject: Re: [PHP-DEV] Re: RFC Idea - is_json - looking for feedback From: php@ollie.codes ("Ollie Read") --5db90591ae7247aca92cd831bb3f3224 Content-Type: text/plain Hey, While I'm not opposed to the idea, I'm struggling to think of a way to accurately determine whether a string is true JSON that doesn't involve some sort of parsing. Sure some regexes can be run on it, but I'm not sure that will ever be 100% accurate. Any parsing of the JSON to determine whether or not it's valid JSON would, in most situations, lead down a code path that then parsed the JSON again, essentially repeating the same function for little benefit. I personally like to use the *`JSON_THROW_ON_ERROR`* flag on json_decode. Not trying to rain on your parade, so sorry if it comes across that way, I'm just not sure of a way to do it where the benefit outweighs the cons, but then again, there are people a lot smarter than me on this list. --- Best Regards, *Ollie Read* --5db90591ae7247aca92cd831bb3f3224--