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

BSON::OrderedHash can be corrupted

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.4.0
    • Affects Version/s: 1.3.1
    • Component/s: None
    • Environment:
      ruby 1.8.7 on linux
    • Fully Compatible

      BSON::OrderedHash can be corrupted

      steps to reproduce:
      execute the following lines:

      a = BSON::OrderedHash.new
      a[:b] = :c
      a.replace(:c => :d)

      results

      a is corrupted. For instance it inspects as:

      {"b"=>nil}

      instead of:
      {:c => :d}

      the method 'replace' on Hash is not overridden !!!!!!!

      implementation suggestion:

      def replace(other_hash)
      @ordered_keys.replace(other_hash.keys)
      super
      end

            Assignee:
            kbanker Kyle Banker
            Reporter:
            thoran Frédéric De Jaeger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: