# Marshal gives error when dumping and loading array with two regexps in latest ruby 1.9

**URL:** <https://www.ruby-forum.com/t/marshal-gives-error-when-dumping-and-loading-array-with-two-regexps-in-latest-ruby-1-9/175601>\
**Category:** Ruby\
**Created:** [September 16, 2009, 11:10am UTC](https://www.ruby-forum.com/t/marshal-gives-error-when-dumping-and-loading-array-with-two-regexps-in-latest-ruby-1-9/175601 "2009-09-16T11:10:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/fbc32d/32.png) [@crocco](https://www.ruby-forum.com/u/crocco)\
**Post date:** [September 16, 2009, 11:10am UTC](https://www.ruby-forum.com/t/marshal-gives-error-when-dumping-and-loading-array-with-two-regexps-in-latest-ruby-1-9/175601/1 "2009-09-16T11:10:51Z")

</div>

I just upgraded my ruby 1.9 to the latest stable version (ruby  
1.9.1-p243),  
and now I’m facing a strange issue. The problem is that attempting to  
use  
Marshal to dump and then load back an array containing two Regexps gives  
an  
error. For example:

str = Marshal.dump [/a/, /b/]  
Marshal.load str

This gives the following error:

/home/stefano/documents/scripts/prova.rb:4:in `load': can't convert Regexp into String (TypeError) from /home/stefano/documents/scripts/prova.rb:4:in`’

The above code worked perfectly with the previous version of ruby 1.9.1.  
Has  
anybody noticed the same issue?

Thanks in advance

Stefano

---

<div class="post-metadata">

**Author:** ![crocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/fbc32d/32.png) [@crocco](https://www.ruby-forum.com/u/crocco)\
**Post date:** [September 16, 2009, 8:28pm UTC](https://www.ruby-forum.com/t/marshal-gives-error-when-dumping-and-loading-array-with-two-regexps-in-latest-ruby-1-9/175601/2 "2009-09-16T20:28:45Z")

</div>

On Wed, Sep 16, 2009 at 2:09 AM, Stefano C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I just upgraded my ruby 1.9 to the latest stable version (ruby 1.9.1-p243),

> str = Marshal.dump [/a/, /b/]  
> Marshal.load str

> This gives the following error:  
> /home/stefano/documents/scripts/prova.rb:4:in `load’: can’t convert Regexp

Hi Stefano,

I get the same error you do with ruby 1.9.1-p243. This code works  
fine with 1.8.6.

Sorry that I don’t know what might be causing this problem.

HTH,

Wayne

* * *

Wayne V.  
No Bugs Software  
Agile Ruby (preferably not Rails), Erlang, C# contract programming on  
Vista, Linux, OS X in Silicon Valley

---

<div class="post-metadata">

**Author:** ![crocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/fbc32d/32.png) [@crocco](https://www.ruby-forum.com/u/crocco)\
**Post date:** [September 17, 2009, 10:21am UTC](https://www.ruby-forum.com/t/marshal-gives-error-when-dumping-and-loading-array-with-two-regexps-in-latest-ruby-1-9/175601/3 "2009-09-17T10:21:43Z")

</div>

On Wednesday 16 September 2009, Wayne V. wrote:

> |On Wed, Sep 16, 2009 at 2:09 AM, Stefano C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:  
> |Hi Stefano,  
> |  
> |I get the same error you do with ruby 1.9.1-p243. This code works  
> |fine with 1.8.6.  
> |  
> |Sorry that I don’t know what might be causing this problem.  
> |  
> |HTH,  
> |  
> |Wayne  
> |

Since I’m not the only one to experience this issue, I’ll report it as a  
bug.

Thanks

Stefano
