This project is archived and is in readonly mode.

#3928 ✓resolved
Tom-Eric Gerritsen

process_parameter_filter throws an exception on array parameters

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

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

Comments and changes to this ticket

  • marcolz

    marcolz February 17th, 2010 @ 02:01 PM

    • 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'
    
  • José Valim

    José Valim February 21st, 2010 @ 01:41 PM

    • State changed from “new” to “resolved”
    • Assigned user set to “José Valim”

    Fixed!

  • Repository

    Repository February 21st, 2010 @ 01:41 PM

    (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...

  • Jeff Kreeftmeijer

    Jeff Kreeftmeijer November 8th, 2010 @ 08:25 AM

    • Tag cleared.

    Automatic cleanup of spam.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages