Re: [RFC][Discussion] Enhance JSON error messages

From: Date: Fri, 28 Jun 2024 13:49:49 +0000
Subject: Re: [RFC][Discussion] Enhance JSON error messages
References: 1 2  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
El jue, 27 jun 2024 a las 1:10, Gina P. Banyard (<[email protected]>) escribió:
>
> On Wednesday, 26 June 2024 at 15:11, juan carlos morales <[email protected]>
> 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


Thread (9 messages)

« previous php.internals (#123987) next »