Project

General

Profile

This project is closed and read-only.

Actions

Backport #2428

closed

URI::Generic#eql? broken when passed nil

Backport #2428: URI::Generic#eql? broken when passed nil

Added by pbmclain (Peter McLain) almost 17 years ago. Updated over 15 years ago.


Description

=begin
URI::Generic#eql? does not check for nil:

 def eql?(oth)
   self.component_ary.eql?(oth.component_ary)
 end

Test Case:

require 'uri'
uri = URI.parse 'http://gemcutter.org'

uri.eql?(nil) # => blows up

Fix:

 def eql?(oth)
   return true if self.equal?(oth)
   self.class.equal?(oth.class) &&
     self.component_ary.eql?(oth.component_ary)
 end

=end

Updated by ujihisa (Tatsuhiro Ujihisa) almost 17 years ago Actions #1

  • Status changed from Open to Assigned
  • Assignee set to akr (Akira Tanaka)

=begin

=end

Updated by ujihisa (Tatsuhiro Ujihisa) almost 17 years ago Actions #2

=begin
Ditto on 1.9.2dev. (The error message is different)

ruby 1.9.2dev (2009-12-04 trunk 25986) [i386-darwin9.8.0]
/Users/ujihisa/rubies/lib/ruby/1.9.1/uri/generic.rb:1069:in eql?': undefined method parser' for nil:NilClass (NoMethodError)
from /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/v766166/63:5:in `

'

=end

Updated by marcandre (Marc-Andre Lafortune) almost 17 years ago Actions #3

  • Category set to lib
  • Status changed from Assigned to Closed

=begin
This issue was solved with changeset r26168 and 26169.
Peter, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Updated by shyouhei (Shyouhei Urabe) over 16 years ago Actions #4

  • Status changed from Closed to Assigned
  • Assignee changed from akr (Akira Tanaka) to shyouhei (Shyouhei Urabe)

=begin

=end

Updated by shyouhei (Shyouhei Urabe) over 16 years ago Actions #5

  • Assignee changed from shyouhei (Shyouhei Urabe) to wyhaines (Kirk Haines)

=begin
1.8.7 fixes this at r27406. 1.8.6 should also be fixed.
=end

Updated by wyhaines (Kirk Haines) over 16 years ago Actions #6

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28255.
Peter, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: PDF Atom