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.

Bug in Chromium with GET parameters when doing a POST request

#3803

With jQuery, I do some ajax requests in POST. As of now, some parameters were given in GET (that's not good. But that was historical).
So I made the request with the following :

jQuery.ajax({
    url: '/my/url?param=test',
    type: 'post'
});

In Firefox 3.5, this call works well. But in Chromium, rails raises an exception when trying to parse the parameters.

Error occurred while parsing request parameters.
Contents:

undefined
/!\ FAILSAFE /!\  28/01/2010 09:47:38
  Status: 500 Internal Server Error
  undefined method `name' for nil:NilClass
    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing'
    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:29:in `merge_element!'
    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:18:in `parse'
    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in `__send__'
    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in `parse'
    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/hash/conversions.rb:164:in `from_xml'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:34:in `parse_formatted_parameters'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:11:in `call'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in `call'
    /usr/lib64/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in `call'

This bug can be corrected by not passing the parameters in GET anymore.

jQuery.ajax({
    url: '/my/url',
    type: 'post',
    data: {
        param: 'test'
    }
});

I don't really know yet if this must be corrected in Chromium, jQuery or rails.

Reported by Damien MATHIEU · January 28th, 2010 @ 08:54 AM

State: resolved
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: Low

Activity

  1. Joe None
    Joe None

    Was having the exact same problem, thanks for posting this. Seems like jQuery shouldn't allow a call like this to happen, in my opinion.

    February 13th, 2010 @ 05:36 PM

  2. Stefan Siebel
    Stefan Siebel

    I was getting the same error message, however the root cause seemed to be another one. My URL looked like /my/url?locale=en. But when I removed the URL param I still got the same error.
    It turned out that I was adding a parameter twice. Once by serializing the form and the second time by calling

    $(document).ajaxSend(function(event, request, settings) {
        settings.data = { someParam: "somevalue" };
    });
    

    After removing these three lines things started working in Google Chrome.

    February 20th, 2010 @ 06:39 PM

  3. Damien MATHIEU
    Damien MATHIEU

    bump !

    This belongs in fact to jQuery. Not rails. Could someone close this ticket please ?
    http://dev.jquery.com/ticket/5123

    it also appears if the data is undefined. We should then set it to null.

    March 3rd, 2010 @ 09:21 AM

  4. Erik St. Martin
    Erik St. Martin
    • Tag changed from chromium, javascript, jquery, params to chromium, invalid, javascript, jquery, params

    March 19th, 2010 @ 02:04 AM

  5. Yehuda Katz (wycats)
    Yehuda Katz (wycats)
    • State changed from new to open
    • Tag changed from chromium, invalid, javascript, jquery, params to chromium, javascript, jquery, rails3
    • Assigned user set to Yehuda Katz (wycats)
    • Milestone cleared.

    This is in fact a jQuery problem, but the Rails error could use some improvement (in general, failsafe errors mean that Rails didn't catch something it should have)

    March 27th, 2010 @ 08:30 AM

  6. Repository
  7. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM