Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ArgumentError when Fallbacks#map used as in Hash #570

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

bagilevi
Copy link
Contributor

@bagilevi bagilevi commented Jun 2, 2021

This can cause a problem with Airbrake when a Fallbacks instance is set as a thread-local variable like this:

Thread.current[:foo] = I18n::Locale::Fallbacks.new(:"de-AT" => :de)
notice = Airbrake.build_notice("hi")
Airbrake::Filters::ThreadFilter.new.call(notice)

Airbrake tries to sanitize the instance, and as it is_a?(Hash) it tries to call map on it with 0 arguments and a block, which raises:

ArgumentError: wrong number of arguments (given 0, expected 1) from
gems/i18n-1.8.10/lib/i18n/locale/fallbacks.rb:74:in `map'

This can cause a problem with Airbrake when a Fallbacks instance is set
as a thread-local variable:

Thread.current[:foo] = I18n::Locale::Fallbacks.new(:"de-AT" => :de)
notice = Airbrake.build_notice("hi")
Airbrake::Filters::ThreadFilter.new.call(notice)

ArgumentError: wrong number of arguments (given 0, expected 1) from
gems/i18n-1.8.10/lib/i18n/locale/fallbacks.rb:74:in `map'
@radar radar merged commit 07e1e83 into ruby-i18n:master Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants