safe
safe copied to clipboard
Clear previous error for json_decode
If you (or your framework) calls the native json_decode function with an invalid JSON string, it will save the last error in json_last_error().
If you then call the Safe function, you will get an error on a valid JSON.
The solution could be to call the native json_decode function once with a valid JSON to clear the last error.
Copied from: https://github.com/laravel/framework/pull/42125/files#diff-35f0fed0fb4be3d1d696cb36c7266cd36daed1aa31c9f74394c38620620776b4R77