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.
This handles a rather unpleasant quirk in PHP where if
json_decode
is called withoutJSON_THROW_ON_ERROR_FLAG
for an invalid json string before callingjson_decode
for a valid json string with said flag thejson_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: https://github.com/thecodingmachine/safe/issues/437#issuecomment-2139132472