Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix more obscure nested parameter hash parsing bug. Closes #10797 [th…

…omas.lee]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9020 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 1e0ac3a673a6cc92c1c6c5bc84180afeb60241d9 1 parent 7750afc
@technoweenie technoweenie authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix more obscure nested parameter hash parsing bug. #10797 [thomas.lee]
+
* Added ActionView::Helpers::register_javascript/stylesheet_expansion to make it easier for plugin developers to inject multiple assets #10350 [lotswholetime]
* Fix nested parameter hash parsing bug. #10797 [thomas.lee]
View
3  actionpack/lib/action_controller/request.rb
@@ -682,7 +682,8 @@ def bind(key, value)
elsif top.is_a? Hash
key = CGI.unescape(key)
parent << (@top = {}) if top.key?(key) && parent.is_a?(Array)
- return top[key] ||= value
+ top[key] ||= value
+ return top[key]
else
raise ArgumentError, "Don't know what to do: top is #{top.inspect}"
end
View
6 actionpack/test/controller/request_test.rb
@@ -711,6 +711,12 @@ def test_parse_params_with_array_prefix_and_hashes
expected = {"a" => [{"b" => {"c" => "d"}}]}
assert_equal expected, ActionController::AbstractRequest.parse_request_parameters(input)
end
+
+ def test_parse_params_with_complex_nesting
+ input = { "a[][b][c][][d][]" => %w(e) }
+ expected = {"a" => [{"b" => {"c" => [{"d" => ["e"]}]}}]}
+ assert_equal expected, ActionController::AbstractRequest.parse_request_parameters(input)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.