Project

General

Profile

Actions

Bug #21677

closed

Integer("08") raises an ArgumentError

Bug #21677: Integer("08") raises an ArgumentError

Added by ben (Björn Engelmann) about 20 hours ago. Updated about 20 hours ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
3.3.0 - 3.3.8
[ruby-core:123746]

Description

ruby version: tried it with 3.3.0 and 3.3.8

When running the following ruby script:

p Integer("04")
p Integer("05")
p Integer("06")
p Integer("07")
p Integer("08")

I get the following output:

4
5
6
7
internal:kernel:307:in Integer': invalid value for Integer(): "08" (ArgumentError) from bug.rb:7:in '

it seems that "08" and "09" are for some reason not parsable, while all other number "00", "01", "02", "03", "04", "05", "06", and "07" are.

I would have expected the Integer-parser to have consistent behaviour, independent of the numbers that are parsed...

By the way: it the same for "008", "0008" and so on.

Actions

Also available in: PDF Atom