Project

General

Profile

Actions

Bug #10886

closed

String#split now throws a RegexpError instead of an ArgumentError

Added by Eregon (Benoit Daloze) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
[ruby-core:68229]

Description

ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux]
-e:1:in `split': invalid byte sequence in UTF-8 (ArgumentError)
	from -e:1:in `<main>'

ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
-e:1:in `split': invalid multibyte character: /\xFF/ (RegexpError)
	from -e:1:in `<main>'

This is leaking implementation details and so I think is a bug as such.
The bug was discovered thanks to https://github.com/rubyspec/rubyspec/blob/archive/core/string/split_spec.rb#L16-L23.

Actions #1

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r49695.


string.c: proper exception

  • string.c (rb_str_split_m): raise ArgumentError at broken string
    not RegexpError, as Regexp is not involved in.
    [ruby-core:68229] [Bug #10886]

Updated by naruse (Yui NARUSE) about 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: DONE

ruby_2_2 r49717 merged revision(s) 49695.

Actions

Also available in: Atom PDF

Like0
Like0Like0