Project

General

Profile

Actions

Backport #2428

closed

URI::Generic#eql? broken when passed nil

Added by pbmclain (Peter McLain) over 14 years ago. Updated almost 13 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

Actions #1

Updated by ujihisa (Tatsuhiro Ujihisa) over 14 years ago

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

=begin

=end

Actions #2

Updated by ujihisa (Tatsuhiro Ujihisa) over 14 years ago

=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

Actions #3

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • 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

Actions #4

Updated by shyouhei (Shyouhei Urabe) about 14 years ago

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

=begin

=end

Actions #5

Updated by shyouhei (Shyouhei Urabe) almost 14 years ago

  • 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

Actions #6

Updated by wyhaines (Kirk Haines) almost 14 years ago

  • 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: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0