ipaddr icon indicating copy to clipboard operation
ipaddr copied to clipboard

`IPAddr.new("0.0.0.0") == nil` return true

Open taketo1113 opened this issue 6 months ago • 0 comments

IPAddr.new("0.0.0.0") == nil and nil == IPAddr.new("0.0.0.0") return different result.

Steps to reproduce

# IPv4
IPAddr.new("0.0.0.0") == nil
=> true # expected false

nil == IPAddr.new('0.0.0.0') 
=> false

IPAddr.new("0.0.0.0").nil?
=> false

# IPv6
IPAddr.new("::") == nil
=> true # expected false

nil == IPAddr.new("::")
=> false

IPAddr.new("::").nil?
=> false

Expected behavior

IPAddr.new("0.0.0.0") == nil return false, just like IPAddr.new("0.0.0.0").nil?.

Actual behavior

IPAddr.new("0.0.0.0") == nil return true.

System configuration

  • IPAddr version: 1.2.5
  • Ruby version: 3.3.4

Related Issue

  • https://github.com/rails/rails/pull/51758#issuecomment-2311677430
  • #21

taketo1113 avatar Aug 27 '24 13:08 taketo1113