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.

Rack::Utils.parse_nested_query throws exceptions, leads to 500 errors on every Rails app

#2611

On Rails 2.3.2:

Rack::Utils.parse_nested_query('x=0&x[y]=1') IndexError: string not matched

This leads to 500 errors on any Rails app. For instance: http://rubyonrails.org?x=0&x[y]=1

I would expect "x=0&x[y]=1" to generate params['x'] == { 'y' => '1' }. This would follow Rails's "form.checkbox()" convention, in which "?x=0&x=1" leads to params['x'] == '1'.

I'm quite opinionated about Rack's being the wrong place to do parameter parsing (see http://groups.google.com/group/r... and the chutzpah Rack has to throw an exception in something as trivial as parameter parsing. (In Rack 1.0.0 the exception is accidental, but in git master it becomes explicit.)

Please stop my Rails app from generating 500 errors when users enter the wrong URL! (And, as a helpful bonus, please make "x=0&x[y]=1" generate params == "{ 'x' => { 'y' => '1' } }", so my app will work ;).)

Reported by Adam Hooper · May 5th, 2009 @ 11:59 PM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: none

Activity

  1. Adam Hooper
    Adam Hooper

    Attached: patch to not-crash when Rack::Request.GET or Rack::Request.POST return nil.

    This does not fix the issue, but at least it lets Rails print out a nice stack trace. (I'm not entirely clear why.) I imagine that means it lets the "exception_notification" plugin work.

    May 6th, 2009 @ 04:35 PM

  2. Adam Hooper
    Adam Hooper

    Patch which handles TypeError as well. This makes the 500 errors go away.

    May 6th, 2009 @ 05:01 PM

  3. Adam Hooper
    Adam Hooper

    Monkey-patch which can be included in config/initializers on any Rails 2.3.2 app

    May 6th, 2009 @ 05:03 PM

  4. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.x to 3.x

    May 4th, 2010 @ 06:48 PM

  5. xhming
  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:51 PM

  7. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:51 PM