Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

process_parameter_filter throws an exception on array parameters

#3928

In a fresh rails 3 application, if I visit /?x[]=y, then I'll get the following exception: NoMethodError (undefined methodeach' for "y":String):

Backtrace can be found here: http://gist.github.com/301411

Workaround: comment out the config.filter_parameters << :password line in your application.rb

Reported by Tom-Eric Gerritsen · February 11th, 2010 @ 11:15 AM

State: resolved
Milestone: none
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. marcolz
    marcolz
    • Tag set to query string, action_dispatch, array, process_parameter_filter, rails3

    Same here, but with a slightly different error message:

    irb(main):007:0> app.get '/?foo[]=bar&foo[]=pub'
    NoMethodError: You have a nil object when you didn't expect it!
    You might have expected an instance of Array.
    The error occurred while evaluating nil.each
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:78:in `process_parameter_filter'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:84:in `process_parameter_filter'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:84:in `map'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:84:in `process_parameter_filter'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:78:in `each'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:78:in `process_parameter_filter'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/http/filter_parameters.rb:30:in `filtered_parameters'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_controller/metal/instrumentation.rb:20:in `process_action'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_controller/metal/rescue.rb:8:in `process_action'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/abstract_controller/base.rb:115:in `process'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_controller/metal.rb:64:in `dispatch'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_controller/metal/rack_delegation.rb:19:in `dispatch'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_controller/metal.rb:89:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/routing/route_set.rb:27:in `call'
        from /Users/marco/.bundle/ruby/1.8/gems/rack-mount-0.4.7/lib/rack/mount/recognition/route_set.rb:70:in `call'
        from /Users/marco/.bundle/ruby/1.8/gems/rack-mount-0.4.7/lib/rack/mount/recognition/code_generation.rb:97:in `recognize'
    

    ... 18 levels...

        from /opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/callbacks.rb:88:in `run_callbacks'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/middleware/callbacks.rb:44:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/middleware/show_exceptions.rb:62:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/rack/logger.rb:13:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/runtime.rb:17:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/middleware/static.rb:30:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:95:in `call'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-test-0.5.3/lib/rack/mock_session.rb:30:in `request'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-test-0.5.3/lib/rack/test.rb:207:in `process_request'
        from /opt/local/lib/ruby/gems/1.8/gems/rack-test-0.5.3/lib/rack/test.rb:105:in `request'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/testing/integration.rb:272:in `process'
        from /opt/local/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta/lib/action_dispatch/testing/integration.rb:30:in `get'
    

    February 17th, 2010 @ 02:01 PM

  2. José Valim
    José Valim
    • State changed from new to resolved
    • Assigned user set to José Valim

    Fixed!

    February 21st, 2010 @ 01:41 PM

  3. Repository
    Repository

    (from [a7b78e86b3b78cf4f461cd372d914ff3a6295c1b]) Add a tests which ensures filtered_parameters does not raise an error for a mixed array [#3928 status:resolved] http://github.com/rails/rails/commit/a7b78e86b3b78cf4f461cd372d914f...

    February 21st, 2010 @ 01:41 PM

  4. Jeff Kreeftmeijer
    Jeff Kreeftmeijer
    • Tag cleared.

    Automatic cleanup of spam.

    November 8th, 2010 @ 08:25 AM