• P
    Fix an issue with JSON encoding of "Infinity" and "NaN" values · 8776f15b
    Prathamesh Sonpatki 提交于
    - When `as_json` returns `Infinity` or `NaN` as the value of any of the key,
      we don't used to call `as_json` on it as it was treated as primitive.
    - This used to pass `Infinity` or `NaN` to `JSON.generate` and Ruby used
      to throw an error for `Infinity/NaN not allowed in JSON.`
    - This patch changes the code to call `as_json` on these primitives so
      that they are converted to proper values before being passed to
      `JSON.generate`.
    - Fixes #26877.
    8776f15b
encoding_test.rb 14.2 KB