activesupport 4.2.0 → 4.2.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +280 -0
  3. data/lib/active_support/cache/mem_cache_store.rb +1 -1
  4. data/lib/active_support/cache.rb +3 -3
  5. data/lib/active_support/callbacks.rb +126 -82
  6. data/lib/active_support/concern.rb +1 -1
  7. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +2 -0
  8. data/lib/active_support/core_ext/class/subclasses.rb +0 -2
  9. data/lib/active_support/core_ext/date/conversions.rb +6 -0
  10. data/lib/active_support/core_ext/date_and_time/calculations.rb +11 -0
  11. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  12. data/lib/active_support/core_ext/date_time/calculations.rb +23 -3
  13. data/lib/active_support/core_ext/date_time/compatibility.rb +15 -0
  14. data/lib/active_support/core_ext/date_time.rb +1 -0
  15. data/lib/active_support/core_ext/enumerable.rb +16 -0
  16. data/lib/active_support/core_ext/hash/compact.rb +19 -15
  17. data/lib/active_support/core_ext/hash/conversions.rb +1 -2
  18. data/lib/active_support/core_ext/hash/transform_values.rb +2 -2
  19. data/lib/active_support/core_ext/integer/time.rb +0 -15
  20. data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
  21. data/lib/active_support/core_ext/kernel/reporting.rb +1 -0
  22. data/lib/active_support/core_ext/marshal.rb +8 -5
  23. data/lib/active_support/core_ext/module/delegation.rb +24 -12
  24. data/lib/active_support/core_ext/module/method_transplanting.rb +3 -1
  25. data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
  26. data/lib/active_support/core_ext/numeric/time.rb +0 -15
  27. data/lib/active_support/core_ext/object/blank.rb +2 -2
  28. data/lib/active_support/core_ext/object/duplicable.rb +58 -32
  29. data/lib/active_support/core_ext/object/json.rb +2 -2
  30. data/lib/active_support/core_ext/object/try.rb +2 -2
  31. data/lib/active_support/core_ext/string/access.rb +1 -1
  32. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  33. data/lib/active_support/core_ext/string/filters.rb +4 -3
  34. data/lib/active_support/core_ext/string/output_safety.rb +6 -2
  35. data/lib/active_support/core_ext/time/calculations.rb +18 -2
  36. data/lib/active_support/core_ext/time/compatibility.rb +14 -0
  37. data/lib/active_support/core_ext/time.rb +1 -0
  38. data/lib/active_support/deprecation/behaviors.rb +1 -1
  39. data/lib/active_support/duration.rb +25 -1
  40. data/lib/active_support/gem_version.rb +1 -1
  41. data/lib/active_support/hash_with_indifferent_access.rb +22 -3
  42. data/lib/active_support/inflector/methods.rb +1 -1
  43. data/lib/active_support/json/encoding.rb +5 -0
  44. data/lib/active_support/logger.rb +50 -0
  45. data/lib/active_support/logger_silence.rb +7 -4
  46. data/lib/active_support/logger_thread_safe_level.rb +32 -0
  47. data/lib/active_support/message_encryptor.rb +8 -1
  48. data/lib/active_support/message_verifier.rb +1 -1
  49. data/lib/active_support/multibyte/chars.rb +1 -1
  50. data/lib/active_support/notifications/fanout.rb +1 -1
  51. data/lib/active_support/number_helper/number_to_rounded_converter.rb +1 -1
  52. data/lib/active_support/per_thread_registry.rb +5 -3
  53. data/lib/active_support/security_utils.rb +7 -0
  54. data/lib/active_support/testing/time_helpers.rb +16 -13
  55. data/lib/active_support/time_with_zone.rb +29 -17
  56. data/lib/active_support/values/time_zone.rb +10 -5
  57. data/lib/active_support/xml_mini/jdom.rb +6 -5
  58. data/lib/active_support/xml_mini/libxml.rb +1 -3
  59. data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
  60. data/lib/active_support/xml_mini/nokogiri.rb +1 -3
  61. data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
  62. data/lib/active_support/xml_mini/rexml.rb +7 -8
  63. data/lib/active_support/xml_mini.rb +33 -15
  64. data/lib/active_support.rb +9 -0
  65. metadata +7 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a92aaed8c92253b60d615c68b681d0187185010
4
- data.tar.gz: 16a0f7761127de79598b4787717f1d90da9d64fd
3
+ metadata.gz: c79e2313b53d2f2ac8f2d1f1ccdf57e384d7b08b
4
+ data.tar.gz: 50014a92254ff38a792a7795e4a8971e03f9675a
5
5
  SHA512:
6
- metadata.gz: 81470e00892e899e539f8791a1d6ba3a86d0a2e3760a0719c7922a987c92337d10dbffe9e157357d456c4aba6d64c6c71366db8b6772c19435ab64cd7c55894b
7
- data.tar.gz: 9e645639534174a986106a4a4df445c6c13498ef3e419dacab8b67870c088199412ed8db81a96a7a73e0c526d0971dc5368bbd8a2027252e632ba867c46be975
6
+ metadata.gz: f33f8a5961998c951c7a52053bfecfc264280b311150ff3b08dd694fcc75c182388b5abd1aa3da9cf001bd1da4b5b41d419fa1cdcb498ddd9a046ee7cd267240
7
+ data.tar.gz: d141a4086bde1a80ad72e8b0af57af9033bd6c5c89aa42496e0ef634a222cc3e157d7e27489e81dbf6907597f74da00e8858b0e22f151865b28555c54a19ab6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,283 @@
1
+ ## Rails 4.2.10 (September 27, 2017) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 4.2.9 (June 26, 2017) ##
7
+
8
+ * Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
9
+ raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
10
+ Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
11
+ when calling `#to_time`.
12
+
13
+ *Kevin McPhillips* & *Andrew White*
14
+
15
+ * Restore the return type of `DateTime#utc`
16
+
17
+ In Rails 5.0 the return type of `DateTime#utc` was changed to `Time` to be
18
+ consistent with the new `DateTime#localtime` method. When these changes were
19
+ backported in #27553 this inadvertently changed the return type in a patcn
20
+ release. Since `DateTime#localtime` was new in Rails 4.2.8 it's okay to
21
+ restore the return type of `DateTime#utc` but keep `DateTime#localtime` as
22
+ returning `Time` without breaking backwards compatibility.
23
+
24
+ *Andrew White*
25
+
26
+ * In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
27
+ argument for `Marshal#load( source [, proc] )`. This way we don't have to do
28
+ `Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
29
+
30
+ *Jeff Latz*
31
+
32
+ * Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
33
+
34
+ *Adam Rice*
35
+
36
+ * `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
37
+ `Time.now` and `Date.today`.
38
+
39
+ *Yuki Nishijima*
40
+
41
+
42
+ ## Rails 4.2.8 (February 21, 2017) ##
43
+
44
+ * Make `getlocal` and `getutc` always return instances of `Time` for
45
+ `ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
46
+ stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
47
+ was wrapping a `DateTime` instance. As a consequence of this the internal
48
+ time value in `ActiveSupport::TimeWithZone` is now always an instance of
49
+ `Time` in the UTC timezone, whether that's as the UTC time directly or
50
+ a representation of the local time in the timezone. There should be no
51
+ consequences of this internal change and if there are it's a bug due to
52
+ leaky abstractions.
53
+
54
+ *Andrew White*
55
+
56
+ * Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
57
+
58
+ *Andrew White*
59
+
60
+ * Add additional aliases for `DateTime#utc` to mirror the ones on
61
+ `ActiveSupport::TimeWithZone` and `Time`.
62
+
63
+ *Andrew White*
64
+
65
+ * Add `DateTime#localtime` to return an instance of `Time` in the system's
66
+ local timezone. Also aliased to `getlocal`.
67
+
68
+ *Andrew White*, *Yuichiro Kaneko*
69
+
70
+ * Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
71
+
72
+ *Andrew White*
73
+
74
+ * Add `ActiveSupport.to_time_preserves_timezone` config option to control
75
+ how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
76
+ from converting to the local system timezone, to preserving the timezone
77
+ of the receiver. This config option defaults to false so that apps made
78
+ with earlier versions of Rails are not affected when upgrading, e.g:
79
+
80
+ >> ENV['TZ'] = 'US/Eastern'
81
+
82
+ >> "2016-04-23T10:23:12.000Z".to_time
83
+ => "2016-04-23T06:23:12.000-04:00"
84
+
85
+ >> ActiveSupport.to_time_preserves_timezone = true
86
+
87
+ >> "2016-04-23T10:23:12.000Z".to_time
88
+ => "2016-04-23T10:23:12.000Z"
89
+
90
+ Fixes #24617.
91
+
92
+ *Andrew White*
93
+
94
+ * Add `init_with` to `ActiveSupport::TimeWithZone` and `ActiveSupport::TimeZone`
95
+
96
+ It is helpful to be able to run apps concurrently written in successive
97
+ versions of Rails to aid migration, e.g. run Rails 4.2 and 5.0 variants
98
+ of your application at the same time to carry out A/B testing.
99
+
100
+ To do this serialization formats need to be cross compatible and the
101
+ change in 3aa26cf didn't meet this criteria because the Psych loader
102
+ checks for the existence of `init_with` before setting the instance
103
+ variables and the wrapping behavior of `ActiveSupport::TimeWithZone`
104
+ tries to see if the `Time` instance responds to `init_with` before the
105
+ `@time` variable is set.
106
+
107
+ To fix this we backported just the `init_with` behavior from the change
108
+ in 3aa26cf. If the revived instance is then written out to YAML again
109
+ it will revert to the default Rails 4.2 behavior of converting it to
110
+ a UTC timestamp string.
111
+
112
+ Fixes #26296.
113
+
114
+ *Andrew White*
115
+
116
+ * Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
117
+
118
+ Previously calls to `in` were being sent to the non-DST aware
119
+ method `Time#since` via `method_missing`. It is now aliased to
120
+ the DST aware `ActiveSupport::TimeWithZone#since` which handles
121
+ transitions across DST boundaries, e.g:
122
+
123
+ Time.zone = "US/Eastern"
124
+
125
+ t = Time.zone.local(2016,11,6,1)
126
+ # => Sun, 06 Nov 2016 01:00:00 EDT -05:00
127
+
128
+ t.in(1.hour)
129
+ # => Sun, 06 Nov 2016 01:00:00 EST -05:00
130
+
131
+ Fixes #26580.
132
+
133
+ *Thomas Balthazar*
134
+
135
+
136
+ ## Rails 4.2.7 (July 12, 2016) ##
137
+
138
+ * Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
139
+ properly delegate to all loggers. Silencing now properly suppresses logging
140
+ to both the log and the console.
141
+
142
+ *Kevin McPhillips*
143
+
144
+ * Backported `ActiveSupport::LoggerThreadSafeLevel`. Assigning the
145
+ `Rails.logger.level` is now thread safe.
146
+
147
+ *Kevin McPhillips*
148
+
149
+ * Fixed a problem with ActiveSupport::SafeBuffer.titleize calling capitalize
150
+ on nil.
151
+
152
+ *Brian McManus*
153
+
154
+ * Time zones: Ensure that the UTC offset reflects DST changes that occurred
155
+ since the app started. Removes UTC offset caching, reducing performance,
156
+ but this is still relatively quick and isn't in any hot paths.
157
+
158
+ *Alexey Shein*
159
+
160
+ * Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
161
+ which resolves to a different name.
162
+
163
+ *Olek Janiszewski*
164
+
165
+
166
+ ## Rails 4.2.6 (March 07, 2016) ##
167
+
168
+ * No changes.
169
+
170
+
171
+ ## Rails 4.2.5.2 (February 26, 2016) ##
172
+
173
+ * No changes.
174
+
175
+
176
+ ## Rails 4.2.5.1 (January 25, 2015) ##
177
+
178
+ * No changes.
179
+
180
+
181
+ ## Rails 4.2.5 (November 12, 2015) ##
182
+
183
+ * Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
184
+ twz = DateTime.now.in_time_zone
185
+ twz.eql?(twz.dup) => true
186
+
187
+ Fixes #14178.
188
+
189
+ *Roque Pinel*
190
+
191
+ * Handle invalid UTF-8 characters in `MessageVerifier.verify`.
192
+
193
+ *Roque Pinel*, *Grey Baker*
194
+
195
+
196
+ ## Rails 4.2.4 (August 24, 2015) ##
197
+
198
+ * Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
199
+ with the Active Support JSON encoder loaded.
200
+
201
+ Fixes #20775.
202
+
203
+ *Sammy Larbi*, *Prathamesh Sonpatki*
204
+
205
+ * Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
206
+ `default_proc` is set, which could raise.
207
+
208
+ *Simon Eskildsen*
209
+
210
+ * Fix setting `default_proc` on `HashWithIndifferentAccess#dup`
211
+
212
+ *Simon Eskildsen*
213
+
214
+
215
+ ## Rails 4.2.3 (June 25, 2015) ##
216
+
217
+ * Fix a range of values for parameters of the Time#change
218
+
219
+ *Nikolay Kondratyev*
220
+
221
+ * Add some missing `require 'active_support/deprecation'`
222
+
223
+ *Akira Matsuda*
224
+
225
+
226
+ ## Rails 4.2.2 (June 16, 2015) ##
227
+
228
+ * Fix XSS vulnerability in `ActiveSupport::JSON.encode` method.
229
+
230
+ CVE-2015-3226.
231
+
232
+ *Rafael Mendonça França*
233
+
234
+ * Fix denial of service vulnerability in the XML processing.
235
+
236
+ CVE-2015-3227.
237
+
238
+ *Aaron Patterson*
239
+
240
+
241
+ ## Rails 4.2.1 (March 19, 2015) ##
242
+
243
+ * Fixed a problem where String#truncate_words would get stuck with a complex
244
+ string.
245
+
246
+ *Henrik Nygren*
247
+
248
+ * Fixed a roundtrip problem with AS::SafeBuffer where primitive-like strings
249
+ will be dumped as primitives:
250
+
251
+ Before:
252
+
253
+ YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
254
+ YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
255
+ YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
256
+ YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
257
+ YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
258
+
259
+ After:
260
+
261
+ YAML.load ActiveSupport::SafeBuffer.new("Hello").to_yaml # => "Hello"
262
+ YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
263
+ YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
264
+ YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
265
+ YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
266
+
267
+ *Godfrey Chan*
268
+
269
+ * Replace fixed `:en` with `I18n.default_locale` in `Duration#inspect`.
270
+
271
+ *Dominik Masur*
272
+
273
+ * Add missing time zone definitions for Russian Federation and sync them
274
+ with `zone.tab` file from tzdata version 2014j (latest).
275
+
276
+ *Andrey Novikov*
277
+
278
+
279
+ ## Rails 4.2.0 (December 20, 2014) ##
280
+
1
281
  * The decorated `load` and `require` methods are now kept private.
2
282
 
3
283
  Fixes #17553.
@@ -67,7 +67,7 @@ module ActiveSupport
67
67
  options = names.extract_options!
68
68
  options = merged_options(options)
69
69
  keys_to_names = Hash[names.map{|name| [escape_key(namespaced_key(name, options)), name]}]
70
- raw_values = @data.get_multi(keys_to_names.keys, :raw => true)
70
+ raw_values = @data.get_multi(keys_to_names.keys)
71
71
  values = {}
72
72
  raw_values.each do |key, value|
73
73
  entry = deserialize_entry(value)
@@ -27,7 +27,7 @@ module ActiveSupport
27
27
  end
28
28
 
29
29
  class << self
30
- # Creates a new CacheStore object according to the given options.
30
+ # Creates a new Store object according to the given options.
31
31
  #
32
32
  # If no arguments are passed to this method, then a new
33
33
  # ActiveSupport::Cache::MemoryStore object will be returned.
@@ -562,7 +562,7 @@ module ActiveSupport
562
562
  def handle_expired_entry(entry, key, options)
563
563
  if entry && entry.expired?
564
564
  race_ttl = options[:race_condition_ttl].to_i
565
- if race_ttl && (Time.now.to_f - entry.expires_at <= race_ttl)
565
+ if (race_ttl > 0) && (Time.now.to_f - entry.expires_at <= race_ttl)
566
566
  # When an entry has :race_condition_ttl defined, put the stale entry back into the cache
567
567
  # for a brief period while the entry is begin recalculated.
568
568
  entry.expires_at = Time.now + race_ttl
@@ -622,7 +622,7 @@ module ActiveSupport
622
622
  # Check if the entry is expired. The +expires_in+ parameter can override
623
623
  # the value set when the entry was created.
624
624
  def expired?
625
- convert_version_4beta1_entry! if defined?(@value)
625
+ convert_version_4beta1_entry! if defined?(@v)
626
626
  @expires_in && @created_at + @expires_in <= Time.now.to_f
627
627
  end
628
628