BSON::OrderedHash#clone is a deep clone in 1.8, and a shallow clone in 1.9

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 1.8.5
    • Affects Version/s: 1.8.2
    • Component/s: None
    • None
    • None
    • Minor Change
    • None
    • None
    • None
    • None
    • None
    • None

      BSON::OrderedHash defines

            def clone
              Marshal::load(Marshal.dump(self))
            end
      

      on ruby 1.8:

          # We only need the body of this class if the RUBY_VERSION is before 1.9
          if RUBY_VERSION < '1.9'
      

      However, #clone is, in general, specified to be a shallow clone, and in fact Hash#clone is shallow. The net result is that BSON::OrderedHash#clone has different semantics in 1.8 and 1.9.

            Assignee:
            Tyler Brock (Inactive)
            Reporter:
            Nelson Elhage
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: