This project is archived and is in readonly mode.
activesupport's to_xml shouldn't modify options hash
Reported by David Burger | July 22nd, 2008 @ 06:04 AM
This patch changes the to_xml core extensions for Array and Hash so that they dup the options hash instead of modifying the passed in version. The current behavior, as demonstrated in script/console, looks like this:
>> options = {:skip_instruct => true}
=> {:skip_instruct=>true}
>> [].to_xml(options)
=> "<nil-classes type=\"array\"/>\n"
>> options
=> {:builder=><nil-classes type="array"/>
<inspect/>
, :indent=>2}
>>
Notice the options hash has been modified by the to_xml call. With included patch, the options hash is not modified:
>> options = {:skip_instruct => true}
=> {:skip_instruct=>true}
>> [].to_xml(options)
=> "<nil-classes type=\"array\"/>\n"
>> options
=> {:skip_instruct=>true}
Comments and changes to this ticket
-
Clemens Kofler July 22nd, 2008 @ 12:10 PM
Good one. Not duping the options hash before using it seems to be a problem that's all across Rails.
+1
-
josh October 28th, 2008 @ 04:30 PM
- State changed from new to stale
Not sure if this is still an issue, just reopen if so.
-
Chris Kampmeier May 18th, 2009 @ 05:42 AM
Yup, this is still a problem, I've been bitten by it a couple times.
+1 for the patch, except that the test for
Hash#to_xml
was actually testingArray#to_xml
. I fixed that, and rebased the patch against master, since it no longer applied. Here's a new one. -
CancelProfileIsBroken August 6th, 2009 @ 02:43 PM
- Tag changed from activesupport, core_ext, edge, patch, to_xml to activesupport, bugmash, core_ext, edge, patch, to_xml
-
Dana Jones August 9th, 2009 @ 08:51 PM
- Assigned user set to Pratik
+1 - Problem exists on both 2-3-stable and 3-0-pre. Neither of the preceding patches would apply cleanly, so I created new patches for both versions.
-
CancelProfileIsBroken August 9th, 2009 @ 08:52 PM
- State changed from stale to open
-
Repository August 9th, 2009 @ 09:47 PM
- State changed from open to resolved
(from [c9d4bcf16337241cc270eddb402b17cc094c609e]) Fix that Hash#to_xml and Array#to_xml shouldn't modify their options hashes [#672 state:resolved] [David Burger, Dana Jones]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/c9d4bcf16337241cc270eddb402b17... -
Repository August 9th, 2009 @ 09:47 PM
(from [1382f4de1f9b0e443e7884bd4da53c20f0754568]) Fix that Hash#to_xml and Array#to_xml shouldn't modify their options hashes [#672 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/1382f4de1f9b0e443e7884bd4da53c... -
CancelProfileIsBroken August 9th, 2009 @ 10:05 PM
- Assigned user cleared.
- Tag changed from activesupport, bugmash, core_ext, edge, patch, to_xml to activesupport, core_ext, edge, patch, to_xml
- Milestone cleared.
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
Attachments
Tags
Referenced by
- 672 activesupport's to_xml shouldn't modify options hash (from [c9d4bcf16337241cc270eddb402b17cc094c609e]) Fix tha...
- 672 activesupport's to_xml shouldn't modify options hash (from [1382f4de1f9b0e443e7884bd4da53c20f0754568]) Fix tha...
- 5356 [PATCH] rails.js fix for submitting forms with multiple submit buttons Based on existing tickets for prototype (https://prototyp...