aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/request.rb3
-rw-r--r--actionpack/test/controller/request_test.rb6
3 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 05e0605da2..0eabe42fa7 100644
--- a/actionpack/CHANGELOG
+++ b/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]
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb
index 9aff733a5c..d817004398 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -682,7 +682,8 @@ module ActionController
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
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index bae4d6ffe4..a12b929477 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -711,6 +711,12 @@ class UrlEncodedRequestParameterParsingTest < Test::Unit::TestCase
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