Skip to content

Marshal.load fails with an explicit nil proc #4526

Closed
@erikogan

Description

@erikogan

Environment

Provide at least:

  • JRuby version: jruby 9.1.8.0 (2.3.1) 2017-03-06 90fc7ab Java HotSpot(TM) 64-Bit Server VM 25.60-b23 on 1.8.0_60-b27 +jit [darwin-x86_64]
  • Operating system and platform: OS X El Capitan Darwin Ilarnek 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
puts Marshal.load(Marshal.dump(without: :proc)).inspect
puts Marshal.load(Marshal.dump(with: :proc), Proc.new {|o| puts o.inspect; o}).inspect
puts Marshal.load(Marshal.dump(with: :nil_proc), nil).inspect

Originally I thought this might be caused by the ActiveSupport 5.0.2 monkey-patch of Marshal.load. That was a red herring.

Expected Behavior

Note: Original test case available in rails/rails#28342

{:without=>:proc}
:with
:proc
{:with=>:proc}
{:with=>:proc}
{:with=>:nil_proc}

Actual Behavior

{:without=>:proc}
:with
:proc
{:with=>:proc}
{:with=>:proc}
NoMethodError: undefined method `call' for nil:NilClass
Did you mean?  caller
    load at org/jruby/RubyMarshal.java:145
  <main> at tmp/marshal_bug.rb:5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions