File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change
1
+ * Calling ActiveSupport::JSON.decode with unsupported options now raises an error.
2
+
3
+ * Godfrey Chan*
4
+
1
5
* Support : unless_exist in FileStore
2
6
3
7
* Michael Grosser*
Original file line number Diff line number Diff line change @@ -14,7 +14,14 @@ class << self
14
14
# ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
15
15
# => {"team" => "rails", "players" => "36"}
16
16
def decode ( json , options = { } )
17
- data = ::JSON . parse ( json , options . merge ( create_additions : false , quirks_mode : true ) )
17
+ if options . present?
18
+ raise ArgumentError , "In Rails 4.1, ActiveSupport::JSON.decode no longer " \
19
+ "accepts an options hash for MultiJSON. MultiJSON reached its end of life " \
20
+ "and has been removed."
21
+ end
22
+
23
+ data = ::JSON . parse ( json , quirks_mode : true )
24
+
18
25
if ActiveSupport . parse_json_times
19
26
convert_dates_from ( data )
20
27
else
Original file line number Diff line number Diff line change @@ -98,10 +98,8 @@ def test_failed_json_decoding
98
98
assert_raise ( ActiveSupport ::JSON . parse_error ) { ActiveSupport ::JSON . decode ( %() ) }
99
99
end
100
100
101
- def test_cannot_force_json_unmarshalling
102
- encodeded = %q({"json_class":"TestJSONDecoding::Foo"})
103
- decodeded = { "json_class" => "TestJSONDecoding::Foo" }
104
- assert_equal decodeded , ActiveSupport ::JSON . decode ( encodeded , create_additions : true )
101
+ def test_cannot_pass_unsupported_options
102
+ assert_raise ( ArgumentError ) { ActiveSupport ::JSON . decode ( "" , create_additions : true ) }
105
103
end
106
104
end
107
105
You can’t perform that action at this time.
0 commit comments