Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123871 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 91B891A009C for ; Wed, 26 Jun 2024 16:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719419316; bh=xUpsBVX9Y25qbTgmjIJFya/9S7ISN68FqZmB8Gef4A8=; h=In-Reply-To:References:Date:From:To:Subject:From; b=YtJV8U1nx+42U66+hFI8J4Fj1f0nW8IFlZE6yAtWV2NVZLgMPcRyLPVkAg8J7TjyL CjxrzYubx5VtsnBmcVHCwECgAqdhL9F7PeBh03+yydu8o87wL8xanVcS4JBDdIPvxL HmCUOGhYEQPEAca5LYvf5CHM35q9KJ5U3fc43cFuMzw35lL2Scr5h1ZFBFdJZiFJJi uG5pjAsFTfGk0NjU32viwOYDKTniMp5roZnwW/Qk1KReYJA0sSGeT7Y5Vy18vtv61o xpzmxk9fSnhGThmUjyu0owxPFddVPRSXCKefhVk4ZUef+lOv25khPTbHn1MkThIzJh r7q4HcKm6FuXg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 05346180077 for ; Wed, 26 Jun 2024 16:28:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 26 Jun 2024 16:28:35 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 4FACD11401C6 for ; Wed, 26 Jun 2024 12:27:17 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Wed, 26 Jun 2024 12:27:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1719419237; x= 1719505637; bh=xUpsBVX9Y25qbTgmjIJFya/9S7ISN68FqZmB8Gef4A8=; b=v I3kEn1nia9XsHfUJDhpbjkjpwLTdTD/qwzMqjqp13SMF/epAVzvwAc+k6MCpzb+u hy+UMTPAcZ3vzt+Li1F8qyE+K6P8vkMC3+31qJDGI2M6W6zDGK+TvpTPDGqS0Fon FgRd8t7BMfQSA2eR1N0CCAeAHr8jFWiyzznDciL7SOpCPqcIljL77nv6KWI902Cn +KymgMFRPEl4mTi2yb5dduhuTUKZOi8/4rCu8CjewMueEVMWwkFVz4KUmeKNsVmG qlJLqYefPBreEY5Dqto++wi+Or7efRPFFRtUcPQrX2lr880DFr+rbUbFgv7EZtaL w9JF86IFvXL9vevgwOdAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1719419237; x=1719505637; bh=xUpsBVX9Y25qbTgmjIJFya/9S7IS N68FqZmB8Gef4A8=; b=DE+dqfHsQyap5unq1vEhVmXP/My2yZygSgFM1t6c0UTC SUNgESPQ5/AsTqU9E6PWqZlSRxuMUKaHgv1le9iUvf+5nzAwykOmRCzjW/usSRKN iWO9TYg/ZfLCEKrG9kSCgEF+WQfGai360JF8fove1gCmRw5ONbs3pIIWMp0+ldUV 2BZATqJ3um0ICuqr4sI3Rb1kVIcjyLe/fdyEBS043v2PRATs+yitb6BWNWFooUN2 6OCfe1FHaG82AwT8lb8JHZcyje3rBSdrr6UwjTXxIP+goUp1DPgCUUATBubbuSgz d938N9XqRCoQ5PnjeUKzHcV4kMyPwQiM0x0z/IyhQg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrtddvgddutddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeukeduieeltedvleehteevgeehueetkeefveevkeef ledugfehheetheelkeefheenucffohhmrghinhephihouhhtuhdrsggvpdhgihhthhhusg drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id CE38B1700093; Wed, 26 Jun 2024 12:27:16 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-538-g1508afaa2-fm-20240616.001-g1508afaa Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: <3b050050-e6fd-4a3a-839e-e68000445909@app.fastmail.com> In-Reply-To: References: Date: Wed, 26 Jun 2024 16:26:56 +0000 To: "php internals" Subject: Re: [PHP-DEV] [RFC][Discussion] Enhance JSON error messages Content-Type: text/plain From: larry@garfieldtech.com ("Larry Garfield") On Wed, Jun 26, 2024, at 2:11 PM, juan carlos morales wrote: > Hello Internals. > > I'm here to discuss an improvement in error messages when dealing with > JSON in PHP. > > After watching Derick Rethans speak at the UK PHP Conference: > > https://youtu.be/3U0DGhzSH2U?feature=shared&t=2483 > > I also think it would be very useful to have better error messages. > > At the moment, we get things like "Syntax Error" ... period, no clue > where the JSON is corrupt or anything else. With big JSONs is very > cumberstone to get to the line and character position where the JSON > is corrupt .... for example. > > I am already working in a change that would improve error messages > while working with JSONs. > > What I am very close to achieve is to have error messages like "Syntax > Error - at character position X near content Y" .... something like > that. > > I already know that I can do it, actually there is a Work In Progress > Pull Request for this : > > https://github.com/php/php-src/pull/14672 > > > I repeat, is work in progress. BUT it can be done. Maybe my approach > is not the best ... but one way or another .... it can be done. > > Please let me know your ideas, thoughts about this. > > Please, dont kill me for the actual code, is WIP. > > Thanks in advance to everyone. > > Juan I cannot comment on the implementation, but I am always in favor of error messages that do a better job of telling you what you need to fix. --Larry Garfield