This project is archived and is in readonly mode.

#3205 ✓stale
codebrulee

[PATCH] Fix Hash#from_xml with empty hash (using REXML backend)

Reported by codebrulee | September 15th, 2009 @ 04:11 AM

Prior to XmlMini, the following behavior existed:

Hash.from_xml({}.to_xml) # => {"hash"=>nil}

Currently, however, this is what happens when using REXML (Nokogiri works correctly):

Hash.from_xml({}.to_xml) # => {"hash"=>"\n"}

The attached patch fixes this issue.

Comments and changes to this ticket

  • codebrulee

    codebrulee September 15th, 2009 @ 02:39 PM

    • Tag changed from patch to 2.3.x, activesupport, from_xml, master, patch

    This is a patch against master, but I feel that it should be included in the 2.3.5 release (if at all possible) since it is a regression for 2.3.x.

  • CancelProfileIsBroken

    CancelProfileIsBroken September 25th, 2009 @ 12:11 PM

    • Tag changed from 2.3.x, activesupport, from_xml, master, patch to 2.3.x, activesupport, bugmash, from_xml, master, patch
  • John Pignata

    John Pignata September 27th, 2009 @ 05:12 AM

    +1 verified - applies cleanly to master

  • sr.iniv.t

    sr.iniv.t September 27th, 2009 @ 05:32 AM

    +1 verified on master.

    Patch applies cleanly only on master, but fails on 2-3-stable. Will try to upload a patch for 2-3-stable.

  • Elad Meidar

    Elad Meidar September 27th, 2009 @ 06:17 AM

    +1 verified on master and 2-3-stable Master patch applies cleanly and tests pass.
    i've attached a patch for 2-3-stable.

  • CancelProfileIsBroken

    CancelProfileIsBroken September 27th, 2009 @ 12:04 PM

    • Tag changed from 2.3.x, activesupport, bugmash, from_xml, master, patch to 2.3.x, activesupport, bugmash-review, from_xml, master, patch
  • Rizwan Reza

    Rizwan Reza May 15th, 2010 @ 06:45 PM

    • Tag changed from 2.3.x, activesupport, bugmash-review, from_xml, master, patch to 2.3.x, activesupport, bugmash, from_xml, master, patch
  • Enrico Bianco

    Enrico Bianco May 15th, 2010 @ 09:16 PM

    +1 to the 2-3-stable patch.

    Applies cleanly and all activesupport tests pass.

  • Neeraj Singh

    Neeraj Singh May 15th, 2010 @ 09:55 PM

    I would say that fix should be on the conversion side.

    ruby-1.8.7-p249 > {}.to_xml
     => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<hash>\n</hash>\n"
    

    The output in the above case should not have \n .

    Rather than try to fix it on the parsing side, to_xml should be fixed. Just my thought.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:38 PM

    • State changed from “new” to “open”
    • Tag changed from 2.3.x, activesupport, bugmash, from_xml, master, patch to 23x, activesupport, bugmash, from_xml, master, patch
    • Importance changed from “” to “”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:38 PM

    • State changed from “open” to “stale”
  • joson

    joson April 29th, 2011 @ 09:13 AM

    A Replica Breitling is a timepiece of high quality and functionality and you will have all the class, prestige and luxury of a wealthy, successful individual. By choosing from our selection of luxury Replica Watches , you can improve your self-esteem and feel confident to enter new circles of business associates and friends. These Rolex Replicas will surely enhance your style and only you will know the watch you wear did not cost you $1,000's of dollars.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Referenced by

Pages