Project

General

Profile

Actions

Bug #14552

closed

Kernel#Integer can return a non-Integer object.

Added by mrkn (Kenta Murata) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 2.6.0dev (2018-02-25 trunk 62575) [x86_64-darwin16]
[ruby-core:85813]

Description

I found a bug that Kernel#Integer returns any non-nil object which is a result of to_int.

obj = Object.new
def obj.to_int
  "str"
end
Integer(obj) #=> "str"
Actions

Also available in: Atom PDF