#481 √ resolved
Carl Lerche

Mash will cast all Hashes (and subclasses) to Mash on value assign

Reported by Carl Lerche | September 17th, 2008 @ 09:15 AM | in 0.9.8

Check the following bit of code:


class Magic < Hash ; end
(mash = Mash.new)[:magic] = Magic.new
mash[:magic].class == Mash

It seems that Mash is converting everything that it stores to Mashes (for the []= method and co.). It seems to me that values stored in a Mash should ONLY convert Hashes to Mashes on #update, #merge, etc... values stored in a Mash should not be modified.

This actually breaks sessions since any custom class inherited from Hash will get converted to a Mash (and obviously break everything.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »