Project

General

Profile

Backport #2428

URI::Generic#eql? broken when passed nil

Added by pbmclain (Peter McLain) almost 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:27019]

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

Associated revisions

Revision deed6fbb
Added by wyhaines (Kirk Haines) over 9 years ago

lib/uri/generic.rb: Backport #2428 [ruby-core:27019]; fixed #eql? so that it can handle being passed a nil value.
test/generic/test_generic.rb: added a test for the fix to #eql?.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1

Updated by ujihisa (Tatsuhiro Ujihisa) almost 10 years ago

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

=begin

=end

#2

Updated by ujihisa (Tatsuhiro Ujihisa) almost 10 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 methodparser' for nil:NilClass (NoMethodError)
from /var/folders/Dz/Dz5WpFSZGUaFLA8jp8kT5E+++TM/-Tmp-/v766166/63:5:in `'

=end

#3

Updated by marcandre (Marc-Andre Lafortune) over 9 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

#4

Updated by shyouhei (Shyouhei Urabe) over 9 years ago

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

=begin

=end

#5

Updated by shyouhei (Shyouhei Urabe) over 9 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

#6

Updated by wyhaines (Kirk Haines) over 9 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

Also available in: Atom PDF