Psych.load broken for OpenStruct in Ruby 2.3.0
Deserialising an OpenStruct through Psych::load results in a nil error since OpenStruct now has a respond_to_missing? method whose implementation references OpenStruct's @table instance variable.
To reproduce this issue simply use Psych to dump an OpenStruct and then load it again via Psych::load. I attached an example script that does exactly this. I have also attached the error output I get when running this script.
I'm not sure whether to assign marcandre or tenderlove... Please tell me if you need any further information.
- lib/ostruct.rb (OpenStruct): make respond_to? working on just-allocated objects for workaround of Psych. [ruby-core:72501] [Bug #11884]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 53366:[Backport #11884]
* lib/ostruct.rb (OpenStruct): make respond_to? working on just-allocated objects for workaround of Psych. [ruby-core:72501] [Bug #11884]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Updated by PSchambacher (Pierre Schambacher) over 3 years ago
I'm sorry to re-open this but I'm getting a similar error with Syck and Ruby 2.3.1 just released
I attached a repro script and the log that I get when running it. Like psych, the @table instance variable of the OpenStruct isn't initialized when respond_to_missing? gets called.