aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2006-05-16 20:56:41 +0000
committerMichael Koziarski <michael@koziarski.com>2006-05-16 20:56:41 +0000
commitd153525c53ef6158e2f6b6ba15f10b43d2b8d21a (patch)
tree8de56ffbd88595a3012690995cd783758c12ab6b
parentbe3a4849a909545de444ef6d4f5751eea8a3ba1f (diff)
downloadrails-d153525c53ef6158e2f6b6ba15f10b43d2b8d21a.tar.gz
rails-d153525c53ef6158e2f6b6ba15f10b43d2b8d21a.tar.bz2
rails-d153525c53ef6158e2f6b6ba15f10b43d2b8d21a.zip
Fix NoMethodError when parsing params like &&. [Adam Greenfield]. Closes #4955
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4343 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/cgi_ext/cgi_methods.rb1
-rwxr-xr-xactionpack/test/controller/cgi_test.rb6
3 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 7eb69f4fbd..9a75a3852c 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fix NoMethodError when parsing params like &&. [Adam Greenfield]
+
* Fix flip flopped logic in docs for url_for's :only_path option. Closes #4998. [esad@esse.at]
* form.text_area handles the :size option just like the original text_area (:size => '60x10' becomes cols="60" rows="10"). [Jeremy Kemper]
diff --git a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
index 941646c530..37eb8d5cd7 100755
--- a/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
+++ b/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
@@ -45,6 +45,7 @@ class CGIMethods #:nodoc:
parsed_params = {}
for key, value in params
+ next if key.nil?
value = [value] if key =~ /.*\[\]$/
unless key.include?('[')
# much faster to test for the most common case first (GET)
diff --git a/actionpack/test/controller/cgi_test.rb b/actionpack/test/controller/cgi_test.rb
index ddf68fdf5b..06f721997d 100755
--- a/actionpack/test/controller/cgi_test.rb
+++ b/actionpack/test/controller/cgi_test.rb
@@ -227,6 +227,12 @@ class CGITest < Test::Unit::TestCase
expected = { "a/b@" => { "c" => { "d[e" => ["f"] }}}
assert_equal expected, CGIMethods.parse_request_parameters(input)
end
+
+ def test_parse_params_with_nil_key
+ input = { nil => nil, "test2" => %w(value1) }
+ expected = { "test2" => "value1" }
+ assert_equal expected, CGIMethods.parse_request_parameters(input)
+ end
end
class MultipartCGITest < Test::Unit::TestCase