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

Actions

Also available in: PDF Atom