Skip to content

Commit

Permalink
Fix NoMethodError when parsing params like &&. [Adam Greenfield]. Cl…
Browse files Browse the repository at this point in the history
…oses #4955

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4343 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
NZKoz committed May 16, 2006
1 parent be3a484 commit d153525
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 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]
Expand Down
1 change: 1 addition & 0 deletions actionpack/lib/action_controller/cgi_ext/cgi_methods.rb
Expand Up @@ -45,6 +45,7 @@ def CGIMethods.parse_request_parameters(params)
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)
Expand Down
6 changes: 6 additions & 0 deletions actionpack/test/controller/cgi_test.rb
Expand Up @@ -227,6 +227,12 @@ def test_parse_params_with_unmatched_brackets_and_array
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
Expand Down

0 comments on commit d153525

Please sign in to comment.