-
Notifications
You must be signed in to change notification settings - Fork 8k
Json last error msg/error message with location error #20629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json last error msg/error message with location error #20629
Conversation
bukka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks mostly good (nicely taken from jso :) ). Just some minor things.
Other than that I like the new format not exposing the content and just showing the location which I think is acceptable without RFC. Previously I was the only one suggesting a new function but I no longer think it's necessary.
bukka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good.
|
NEWS and UPGRADING updated in 8422224 |
|
I Am so happy |
* 10.5: Update test expectation after php/php-src#20629 Update tools
* 11.5: Update test expectation after php/php-src#20629 Update tools
* 12.5: Update test expectation after php/php-src#20629 Update tools
…ages in PHP 8.6 (xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [HttpClient] fix assertion for updated syntax error messages in PHP 8.6 | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT see php/php-src#20629 Commits ------- 192e32c fix assertion for updated syntax error messages in PHP 8.6
This PR pretends to add the location where the error occurs when processing a json string (
json_validate()orjson_decode()). As the message suggests, is the "nearby location", like MySQL does it when there is an error with a SQL string.I tried to achieve this many times in the past, but failed, my previous approaches were .... terrible and error-prone.
Now I used a different approach suggested by @bukka . I hope I get closer to a descent implementation. Did my best on this one.
I tested with JSON string with 1GB long, and values were calculated correctly for rows and columns.
Thanks for reviewing and I hope this helps.
Credits:
Besides some reading about bison, etc. ... @bukka pointed to https://github.com/libjso/jso which basically exposed me how to port its code to the PHP parser.