Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#1622

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.

Reported by Mark Reginald James · December 23rd, 2008 @ 06:08 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung

    Seems to do the trick over here.

    December 23rd, 2008 @ 11:16 PM

  2. Frederick Cheung
    Frederick Cheung

    Could you rebase this against the latest master? patch no longer applies after the parameter parsing stuff was moved to request_parser.rb

    December 27th, 2008 @ 03:05 PM

  3. Mark Reginald James
  4. Repository
    Repository
    • State changed from new to resolved

    (from [5138f755ff31a8f317d649a6f256c74bc371db70]) Fixed incorrect parsing of query parameters with mixed-depth nesting inside an array [#1622 Incorrect parsing of query parameters with mixed-depth nesting inside an array state:resolved]

    Signed-off-by: Frederick Cheung frederick.cheung@gmail.com http://github.com/rails/rails/co...

    December 30th, 2008 @ 06:09 PM

  5. Repository
    Repository

    (from [ea2090176488246eb780ac654ce5c1063a791dfa]) Fixed incorrect parsing of query parameters with mixed-depth nesting inside an array [#1622 Incorrect parsing of query parameters with mixed-depth nesting inside an array state:resolved]

    Signed-off-by: Frederick Cheung frederick.cheung@gmail.com http://github.com/rails/rails/co...

    February 2nd, 2009 @ 07:57 PM