# Likely bug in Mechanize 0.7.6

**URL:** <https://www.ruby-forum.com/t/likely-bug-in-mechanize-0-7-6/142087>\
**Category:** Ruby\
**Created:** [July 3, 2008, 10:36am UTC](https://www.ruby-forum.com/t/likely-bug-in-mechanize-0-7-6/142087 "2008-07-03T10:36:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [July 3, 2008, 10:36am UTC](https://www.ruby-forum.com/t/likely-bug-in-mechanize-0-7-6/142087/1 "2008-07-03T10:36:17Z")

</div>

I was trying to use Mechanize when it kept throwing an exception at me.  
After trying to debug it, I found this code snippet starting at line 441  
of  
mechanize.rb:

url = ((base && base.uri && base.uri.absolute?) ?  
base.uri :  
cur\_page.uri) + url  
url = cur\_page.uri + url

```
Now, without knowing anything about what this method does or how

```

mechanize even works, I’m pretty sure that this is a bug. The method  
literally crashes when trying to call method “uri” of the variable  
“base.”  
Commenting out the first assignment seems to allow the code to work  
(although I don’t understand how). Hopefully, mechanize doesn’t depend  
on  
any side effects of the various methods called in the first assignment.  
Does anyone know of a proper fix to this bug?  
Thank you…

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [July 3, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/likely-bug-in-mechanize-0-7-6/142087/2 "2008-07-03T22:26:21Z")

</div>

“Eric H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in message  
news:removed\_email\_address@domain.invalid…

> > base.uri :  
> > depend on  
> > any side effects of the various methods called in the first  
> > assignment.  
> > Does anyone know of a proper fix to this bug?
> 
> Did you file a ticket on the Mechanize bug tracker with the way to  
> reproduce it including backtrace and so-forth?

```
Considering how I have no idea what I'm doing... no, I haven't. Do 

```

I do  
this at RubyForge? …under “Submit New?”

---

<div class="post-metadata">

**Author:** ![maz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@maz](https://www.ruby-forum.com/u/maz)\
**Post date:** [July 3, 2008, 8:17pm UTC](https://www.ruby-forum.com/t/likely-bug-in-mechanize-0-7-6/142087/3 "2008-07-03T20:17:15Z")

</div>

On Jul 3, 2008, at 01:32 AM, Just Another Victim of the Ambient  
Morality wrote:

> url = cur\_page.uri + url  
> assignment.  
> Does anyone know of a proper fix to this bug?

Did you file a ticket on the Mechanize bug tracker with the way to  
reproduce it including backtrace and so-forth?
