aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-30 10:04:39 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-30 10:04:39 -0800
commitf12d90486c5bf6b04f304a24dd43a0e1fa782aa6 (patch)
treec73133c957ea709fccb1c4ef85bc08e5456c921c /activesupport/lib/active_support
parent0814e745b777f6eae000d098b127f4f0a9f6cb20 (diff)
parentb815676ea9c6a1700839b2eb218654d30ae30b52 (diff)
downloadrails-f12d90486c5bf6b04f304a24dd43a0e1fa782aa6.tar.gz
rails-f12d90486c5bf6b04f304a24dd43a0e1fa782aa6.tar.bz2
rails-f12d90486c5bf6b04f304a24dd43a0e1fa782aa6.zip
Merge pull request #4227 from gazay/3-2-stable-marshalling
3 2 stable marshalling
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/cache.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 7d032ca984..1a152c68df 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -578,7 +578,17 @@ module ActiveSupport
# it is marshalled and eventually compressed. Both operations yield
# strings.
if @value
- Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
+ # In rails 3.1 and earlier values in entries did not marshaled without
+ # options[:compress] and if it's Numeric.
+ # But after commit a263f377978fc07515b42808ebc1f7894fafaa3a
+ # all values in entries are marshalled. And after that code below expects
+ # that all values in entries will be marshaled (and will be strings).
+ # So here we need a check for old ones.
+ begin
+ Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
+ rescue TypeError
+ compressed? ? Zlib::Inflate.inflate(@value) : @value
+ end
end
end