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

Skip json_last_error check when JSON_THROW_ON_ERROR flag is set in json_decode #451

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

marmichalski
Copy link
Contributor

@marmichalski marmichalski commented Sep 5, 2024

This handles a rather unpleasant quirk in PHP where if json_decode is called without JSON_THROW_ON_ERROR_FLAG for an invalid json string before calling json_decode for a valid json string with said flag the json_error_last method will report the error from the first call, instead of being reset on the second.

I've implemented a simple test to illustrate how this happens.

https://bugs.php.net/bug.php?id=77997

Also found this: #437 (comment)

@marmichalski marmichalski changed the title Skip check when flag is set in Skip json_last_error check when JSON_THROW_ON_ERROR flag is set in json_decode Sep 5, 2024
@staabm staabm merged commit b60ee03 into thecodingmachine:master Nov 28, 2024
7 of 12 checks passed
@staabm
Copy link
Collaborator

staabm commented Nov 28, 2024

thank you

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