This project is archived and is in readonly mode.

#1622 ✓resolved
Mark Reginald James

Incorrect parsing of query parameters with mixed-depth nesting inside an array

Reported by Mark Reginald James | December 23rd, 2008 @ 06:08 PM | in 2.x

Query parameters


x[y][][z]=10&x[y][][v][w]=10

(parameter order is important!)

are assembled into the params hash as


{"x"=>{"y"=>[{"v"=>{}, "z"=>"10"}]}}

instead of the correct


{"x"=>{"y"=>[{"v"=>{"w"=>"10"}, "z"=>"10"}]}}

A patch to request.rb is attached, including a new unit test that fails without the code patch.

The main bug was that on one code branch an empty hash is added to a hash_with_indifferent_access, but the standard empty hash was returned rather than the indifferent_access version of this empty hash, meaning that any updates to this hash did not go into the result hash, but into a separate hash object.

A push of the nesting stack was also missing from this code branch.

Comments and changes to this ticket

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