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.

filter_parameter_logging fails with scalar values in an array

#2927

filter_parameter_logging was enhanced to correctly filter within array params in http://github.com/rails/rails/commit/9407f6e9a428b37517fdd779eac15e....

This patch has a slight issue, which is that it fails when the values within the array are not hashes. This patch fixes the issue.

Reported by Cody Fauser · July 20th, 2009 @ 09:00 PM

State: committed
Milestone: 2.3.4
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Michael Koziarski
    Michael Koziarski
    • Milestone changed from 2.x to 2.3.4
    • Assigned user set to Michael Koziarski

    Targeting 2.3.4 for this

    July 20th, 2009 @ 10:53 PM

  2. Sebastian Delmont
    Sebastian Delmont

    Slightly better patch that allows for nested arrays and hashes. It also includes tests that fail.

    July 20th, 2009 @ 10:59 PM

  3. Sebastian Delmont
    Sebastian Delmont

    Technically, it fails when the values within the array are not enumerable.

    The error didn't surface during testing because param values are always strings under normal conditions.

    Only when testing controllers with params including arrays of integers (for example) you run into this issue.

    A quick workaround is to convert to strings any non-string parameters in your tests.

    July 20th, 2009 @ 11:08 PM

  4. Simone Carletti
    Simone Carletti

    The same here. This issue blocks me from upgrading to Rails 2.3.3.

    With Rails 2.3.3 I have more than 10 failing tests.
    I confirm that the bug has been introduced with http://github.com/rails/rails/commit/9407f6e9a428b37517fdd779eac15e.... Reverting the commit causes the tests to pass again.

    July 21st, 2009 @ 03:12 PM

  5. Michael Koziarski
    Michael Koziarski

    Simone, does this patch fix your problem also?

    July 21st, 2009 @ 10:40 PM

  6. Simone Carletti
    Simone Carletti

    Hi Michael,
    with the second path my tests passes again.

    I've got a couple of failure compared with Rails 2.3.2, but they don't seem to be related to this specific issue but with more probability to an incompatible GEM. That said, I'm confident to confirm Sebastian's patch successfully fixes the bugfix.

    July 21st, 2009 @ 11:29 PM

  7. Repository
    Repository
    • State changed from new to committed

    July 22nd, 2009 @ 10:35 PM