Workaround for Ruby 1.8's fragile Marshal code
git-svn-id: file:///home/svn/framework3/trunk@9689 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
7384dec65e
commit
ef3dbf3841
|
@ -2594,7 +2594,12 @@ class DBManager
|
|||
return nil if not string
|
||||
return nil if string.empty?
|
||||
begin
|
||||
Marshal.load(string.unpack("m")[0])
|
||||
# Validate that it is properly formed base64 first
|
||||
if string.gsub(/\s+/, '') =~ /^([a-z0-9A-Z\+\/=]+)$/
|
||||
Marshal.load($1.unpack("m")[0])
|
||||
else
|
||||
string
|
||||
end
|
||||
rescue ::Exception => e
|
||||
if allow_yaml
|
||||
YAML.load(string) rescue string
|
||||
|
|
Loading…
Reference in New Issue