Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123987 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 BE7F51A009C for ; Fri, 28 Jun 2024 13:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719582681; bh=oBvq6bOADcBjjLy1SdLFIB4hT8Pj7NQtdO1GHeFUg20=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nwbub9hRMP6agbFFgKSSzsFWp57fSV3tYa9X8FdIyTtkYUMjUTR1S02VTqq/Z7JFx hqOZicupL2KxyhgiaiEZClNkww18hNp6uVHs0+h1gW0uXTYlHvkVHyv4gbr9FWGjtq O29XoLk4vJIlYUrdW4Ej7FT5/E1HWtStubVgmCeHNdvMmp2rorOce7UhmGy8OTzByL 3cxI2wF3rklPK7AdR8zNq/H3uxWEZTSzP29wfIzqMDyioAKsPtwDDrF6gCGyx8uPqc gjWOmX27FVIPGJsILmwZPb39p3Pf5Yeri9dHGKBlo3DLGdGBkIlffJGRwFjgctLXtJ N0WqFsTnUaZkQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 250BC180039 for ; Fri, 28 Jun 2024 13:51:20 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, 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 mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (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 ; Fri, 28 Jun 2024 13:51:19 +0000 (UTC) Received: by mail-ua1-f52.google.com with SMTP id a1e0cc1a2514c-80fe7dc99c9so166995241.0 for ; Fri, 28 Jun 2024 06:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719582600; x=1720187400; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oBvq6bOADcBjjLy1SdLFIB4hT8Pj7NQtdO1GHeFUg20=; b=W0s9zZpxSwpXLmIPIHldZjRxX948sJHxygFKncOu6j9G2j7WFD1h9LgKfIJYOQTZ1j WSwszdGfGUBqtNPMCZf8zAodKvnZyH4wpuZON7gaixXU61TBBz/05dc1k+7l1gRJhOoe ZQt4+bAJpWQOYbzwOtSjk4izXjgMsAmLm+JQxuqq5NbM4BrZf1biDvXPjjuJAtfuZICg UfMxJ/gyMzI3FHxFj+vHxme47Sv4AfmhCsNKZtRm36iZym9lBTeDdFT+GOY7wl7kYb5Z kR5OXl/W5INnu2bs+mkxbygCfg8WULFVpjvtMmjSJHmdBCQ2CoTZCjkURVyucZaNxRry 9Z2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719582600; x=1720187400; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oBvq6bOADcBjjLy1SdLFIB4hT8Pj7NQtdO1GHeFUg20=; b=TxK6IWkJC4gMSfln578X5PirpyTpEU4tl6PszSYSL98qRt2t/JLYQFeTKXD7RGZmso IUfah50e077fUjxyZDvSdJeL2FMTl0Q6ynTOM0WQO/IbbOXBgBVXN5PLxL3mU4p/wlTp 7rO2kuP3/GMq8I9gmlgiiegXgv6LU2NJZdu15mgXLl/M3JYRmtDVMh55SFEvBUedijAN FWcfNQdtkngLUvxjh9sfoPff2HEJXOGrvOvaiTN0nUH1eTo073axucKaNzGmOC0arkX8 lFLoIdJ3c/hdsDr7mU3rJyC3ZdiV/3YBhe4D4/YxomYCcTcVNyxbgnphlGu6eEdrbN/g l1FQ== X-Gm-Message-State: AOJu0Yx/bzujTwc/qKrqwE2hYDqaQVHeMAMRFH+EgyAaWfRsYBNg8BRO TilSdL4JkcuT36ob0wZfjvMFEwNEy+k+kd4wCHTjMaCqo6Za5tAdrBnGblxOI8K9O4dFz8Lyuh+ 0cFH1Qm8K5Lrzz+sQoYhtL1sXpZg/Ag== X-Google-Smtp-Source: AGHT+IE3cUhJtPtshmJD7enJ2CJtEHAP3D7P1x/v01k4Pv4kCbGQ3wzr63HGUVSPEb5brOFmCojnC9dxhICHCY9tpQk= X-Received: by 2002:a05:6102:54a2:b0:48f:892b:7ba7 with SMTP id ada2fe7eead31-48f9e7249a4mr1376221137.0.1719582599914; Fri, 28 Jun 2024 06:49:59 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 28 Jun 2024 10:49:49 -0300 Message-ID: Subject: Re: [PHP-DEV] [RFC][Discussion] Enhance JSON error messages To: "Gina P. Banyard" Cc: PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: dev.juan.morales@gmail.com (juan carlos morales) El jue, 27 jun 2024 a las 1:10, Gina P. Banyard () escri= bi=C3=B3: > > On Wednesday, 26 June 2024 at 15:11, juan carlos morales wrote: > > > 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 > > Hello Juan, > > I'm in favour of this, but also I do not think this needs an RFC. > This is just an enhancement to our current crappy parsing errors, > and an RFC feels very much overkill for this. > > Best regards, > > Gina P. Banyard > Suggested by Jakub Zelenka (the main arquitect of the JSON part in php basically), in the PULL REQUEST is better to create a brand new function to have detailed error messages when json encoding, decoding, validating, fails. So, seems a new RFC will be needed. I am working on this at the moment. Will be ready next week or I will try to make it for next week. I am working