Bug #2109
closedMarshal gives error when dumping and loading array with two regexps in ruby 1.9.1-p243
Description
=begin
In ruby 1.9.1-p243, attempting to dump and load again an array containing two or more Regexps gives an error. For example, the following code:
str = Marshal.dump [/a/, /b/]
Marshal.load str
gives this error:
prova.rb:2:in `load': can't convert Regexp into String (TypeError)
The above code worked perfectly with ruby 1.9.1-p129. This is happening in Gentoo Linux.
=end
Updated by matz (Yukihiro Matsumoto) about 15 years ago
=begin
Hi,
In message "Re: [ruby-core:25625] [Bug #2109] Marshal gives error when dumping and loading array with two regexps in ruby 1.9.1-p243"
on Thu, 17 Sep 2009 17:31:25 +0900, Stefano Crocco redmine@ruby-lang.org writes:
|In ruby 1.9.1-p243, attempting to dump and load again an array containing two or more Regexps gives an error. For example, the following code:
|
|str = Marshal.dump [/a/, /b/]
|Marshal.load str
|
|gives this error:
|
|prova.rb:2:in `load': can't convert Regexp into String (TypeError)
|
|The above code worked perfectly with ruby 1.9.1-p129. This is happening in Gentoo Linux.
It doesn't happen on trunk. Could anyone reproduce this one?
matz.
=end
Updated by ngoto (Naohisa Goto) about 15 years ago
=begin
Resemble bug happened on trunk r25000, running on Debian GNU/Linux lenny i386.
a = "\x82\xa0".force_encoding("Windows-31J")
b = "\x82\xa2".force_encoding("Windows-31J")
str = Marshal.dump [ /#{a}/, /#{b}/ ]
puts str.dump
Marshal.load(str)
"\x04\b[\aI/\a\x82\xA0\x10\x06:\rencoding"\x10Windows-31JI/\a\x82\xA2\x10\x06;\x00@\a"
-:5:in load': can't convert Regexp into String (TypeError) from -:5:in
'
% ruby-trunk -v
ruby 1.9.2dev (2009-09-18 trunk 25000) [i686-linux]
=end
Updated by nobu (Nobuyoshi Nakada) about 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r25001.
=end