--TEST-- JSON_THROW_ON_ERROR: global error flag untouched --FILE-- getCode(), PHP_EOL; } var_dump(json_last_error()); try { json_decode("{", false, 512, JSON_THROW_ON_ERROR); } catch (JsonException $e) { echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; } var_dump(json_last_error()); try { json_encode(NAN, JSON_THROW_ON_ERROR); } catch (JsonException $e) { echo "Caught JSON exception: ", $e->getCode(), PHP_EOL; } var_dump(json_last_error()); ?> --EXPECT-- int(0) int(5) Caught JSON exception: 4 int(5) Caught JSON exception: 4 int(5) Caught JSON exception: 7 int(5)