Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-535

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

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

      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@10gen.com Tyler Brock
            Reporter:
            nelhage Nelson Elhage
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: