Skip to content

Regression in 2.10.0: no implicit conversion of false into Proc (TypeError) #748

Closed
@myronmarston

Description

@myronmarston

I'm seeing a new exception from the recently released 2.10.0.

To reproduce, put this in a script:

require "bundler/inline"

gemfile do
  source "https://rubygems.org"
  gem "json", ENV.fetch("JSON_VERSION")
end

require "json"

puts({query: {match_all: {}}}.to_json(as_json: false))

Then run it:

$ JSON_VERSION=2.9.1 ruby json_bug.rb
{"query":{"match_all":{}}}
$ JSON_VERSION=2.10.0 ruby json_bug.rb
/Users/myron/.rvm/gems/ruby-3.3.4/gems/json-2.10.0/lib/json/ext/generator/state.rb:45:in `_configure': no implicit conversion of false into Proc (TypeError)

          _configure(opts)
                     ^^^^
        from /Users/myron/.rvm/gems/ruby-3.3.4/gems/json-2.10.0/lib/json/ext/generator/state.rb:45:in `configure'
        from /Users/myron/.rvm/gems/ruby-3.3.4/gems/json-2.10.0/lib/json/ext/generator/state.rb:27:in `initialize'
        from json_bug.rb:10:in `new'
        from json_bug.rb:10:in `to_json'
        from json_bug.rb:10:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions