Skip to content

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

Closed
m3m0r7 wants to merge 2 commits into
thecodingmachine:masterfrom
memfork:fix-json-last-error-bug
Closed

Fix: the json_last_error will not reset when using JSON_THROW_ON_ERROR flag#405
m3m0r7 wants to merge 2 commits into
thecodingmachine:masterfrom
memfork:fix-json-last-error-bug

Conversation

@m3m0r7
Copy link
Copy Markdown

@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.

@staabm
Copy link
Copy Markdown
Collaborator

staabm commented Nov 28, 2024

I think this got fixed by #451

@staabm staabm closed this Nov 28, 2024
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.

2 participants