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

Already on GitHub? Sign in to your account

fixed failing JSON decoding in rails 3-0-stable #9126

Merged
merged 1 commit into from Feb 11, 2013

Conversation

Projects
None yet
7 participants

This change fixes a JSON decoding problem for strings, fixnums and nil objects introduced by 3.0.20.

ActiveSupport::JSON.decode(ActiveSupport::JSON.encode("foobar"))
ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(42))
ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(nil))

All 3 cases resulted in an ActiveSupport::OkJson::Error being raised.

I've submitted a pull request for Rails 2.3.16 as well. See #9107

tenderlove added a commit that referenced this pull request Feb 11, 2013

Merge pull request #9126 from mbarb0sa/bugfix/json-decoding-in-rails-…
…3-0-stable

fixed failing JSON decoding in rails 3-0-stable

@tenderlove tenderlove merged commit 360af4e into rails:3-0-stable Feb 11, 2013

would be good to get a 3.0.21 release out, since this fix is for a .20 introduced degradation + include the latest sec fixes

Contributor

al2o3cr commented Feb 11, 2013

@steveklabnik - weren't you just pointing out how people shouldn't be calling JSON.load? This patch explicitly swaps out parse for load...

Owner

tenderlove commented Feb 11, 2013

Yes, confirm. I should not have merged this (though it hasn't been released)

Owner

tenderlove commented Feb 11, 2013

I guess it never will be released, so I'll go ahead and revert this for now. Sorry. :'(

tenderlove added a commit that referenced this pull request Feb 11, 2013

Revert "Merge pull request #9126 from mbarb0sa/bugfix/json-decoding-i…
…n-rails-3-0-stable"

This reverts commit 360af4e, reversing
changes made to f93d046.

I fully acknowledge and understand the "no more 3.0.x" releases policy, but would it not be reasonable to predominantly get the word out that 3.0.20 is known to be broken in fairly critical ways, that developers responsible for applications running on 3.0.20 should look to switch from okjson to JSONGem to avoid this breakage, and that they should then strongly consider upgrading to a supported version of Rails?

From my perspective, maintaining a production app currently running 3.0.20 (and looking to upgrade asap!) and discovering breakage around accented characters and other oddities several days after the fact, it would have been very useful to have some kind of authoritative easy-to-find statement of the situation instead of trawling through pull requests.

Contributor

bf4 commented Feb 13, 2013

or since it was reverted

gem 'rails', :git => 'git://github.com/rails/rails.git', :ref => '182d4e3719' # 3.0.21, see https://github.com/rails/rails/pull/9126

could there be a community-maintained branch / fork? (would also likely be useful for the 2.x folks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment