Skip to content

Unable to deserialize recursively #71

@wildmaples

Description

@wildmaples

Hi there! I believe this could be similar to this open issue: #69 but I figure I'd make one for our use case.

It seems like we are unable to

irb(main):001:0> require 'recursive-open-struct'
=> true
irb(main):002:0> Marshal.load(Marshal.dump(RecursiveOpenStruct.new(red: [RecursiveOpenStruct.new]))).red
/Users/maple.ong/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/recursive-open-struct-1.1.3/lib/recursive_open_struct.rb:80:in `[]': undefined method `[]' for nil:NilClass (NoMethodError)

    elsif v.is_a?(Array) and @options[:recurse_over_arrays]
                                     ^^^^^^^^^^^^^^^^^^^^^^
	from /Users/maple.ong/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/recursive-open-struct-1.1.3/lib/recursive_open_struct.rb:142:in `block (2 levels) in new_ostruct_member'
	from (irb):2:in `<main>'
	from /Users/maple.ong/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/irb-1.4.3/exe/irb:11:in `<top (required)>'
	from /Users/maple.ong/.rbenv/versions/3.1.2/bin/irb:25:in `load'
	from /Users/maple.ong/.rbenv/versions/3.1.2/bin/irb:25:in `<main>'

We are trying to upgrade our application to Ruby 3 but we are relying on this behaviour to work. Since it is broken on the latest version we cannot upgrade.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions