Skip to content
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

Fix: the json_last_error will not reset when using JSON_THROW_ON_ERROR flag #405

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

m3m0r7
Copy link

@m3m0r7 m3m0r7 commented Dec 26, 2022

The PHP has a problem that the json_last_error will not reset when turning on the JSON_THROW_ON_ERROR flag.

When I call \Safe\json_decode(...,JSON_THROW_ON_ERROR) after \json_decode("\00 invalid json"), and then the \Safe\json_decode() function throws an exception always because json_last_error was not reset.

I fixed the problem with this pull request.
And I did add tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant