rack/rack — pull request #582 by turley (2013-07-03 09:01:26+00:00)
Title: Create new hash when deep nested keys are repeated instead of overwriting existing values

This fixes an issue when attempting to parse a query string such as the following:

x[y][][z][w]=1&x[y][][z][w]=2

The expected behavior is to produce:
"x" => {"y" => [{"z" => {"w" => "1"}}, {"z" => {"w" => "2"}}]}

Instead, rack is currently parsing it as:
"x" => {"y" => [{"z" => {"w" => "2"}}]}

The previous logic looked at whether the child key existed one level deep, and created the new hash/object (in the array) depending on that test. With this change, the parser scans for one or more nested keys and acts accordingly.