mperham/dalli — Issue #162: DalliStore#escape_key modifies input
Author: ydnar
Created: 2012-01-23 06:37:48+00:00
State: open

The following line calls String#force_encoding, which modifies input, causing undesired side-effects:

https://github.com/mperham/dalli/blob/master/lib/active_support/cache/dalli_store.rb#L153

We tracked this down in production by comparing objects with UTF-8 string keys before and after adding caching code by freezing the object keys. The bug caused a cascade of errors on 1.9.2 mixing a UTF-8 string, now encoded as ASCII-8BIT, into a UTF-8 ERB template.

Current workaround: dup’ing the key before sending to Dalli.