Bug #10150

Tiny URI.parse error incompatibility

Added by Akira Matsuda 8 months ago. Updated 7 months ago.

[ruby-core:64453]
Status:Closed
Priority:Normal
Assignee:Yui NARUSE
ruby -v:ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13] Backport:2.0.0: UNKNOWN, 2.1: UNKNOWN

Description

When giving URI.parse an object that does't respond_to #to_str, Ruby 2.1 raises URI::InvalidURIError, whereas 2.2 raises NoMethodError.
Is this change intentional?

% ruby -v -ruri -e "p URI.parse(1)"
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
.../2.1.2/lib/ruby/2.1.0/uri/common.rb:176:in `split': bad URI(is not URI?): 1 (URI::InvalidURIError)

% ruby -v -ruri -e "p URI.parse(1)"
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]
.../2.2.0-dev/lib/ruby/2.2.0/uri/rfc3986_parser.rb:9:in split': undefined methodto_str' for 1:Fixnum (NoMethodError)

Associated revisions

Revision 47721
Added by glass 7 months ago

  • lib/uri/rfc3986_parser.rb: raise URI::InvalidURIError when
    uri doesn't respond to #to_str. [Bug #10150]

  • test/uri/test_parser.rb: test for above.

Revision 47721
Added by glass 7 months ago

  • lib/uri/rfc3986_parser.rb: raise URI::InvalidURIError when
    uri doesn't respond to #to_str. [Bug #10150]

  • test/uri/test_parser.rb: test for above.

History

#1 Updated by Anonymous 7 months ago

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

Applied in changeset r47721.


  • lib/uri/rfc3986_parser.rb: raise URI::InvalidURIError when
    uri doesn't respond to #to_str. [Bug #10150]

  • test/uri/test_parser.rb: test for above.

Also available in: Atom PDF