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