Project

General

Profile

Actions

Bug #6340

closed

Redefine Net::HTTPResponse#to_ary to avoid implicit conversion errors

Bug #6340: Redefine Net::HTTPResponse#to_ary to avoid implicit conversion errors

Added by lshevtsov (Leonid Shevtsov) over 13 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
Backport:
[ruby-core:44530]

Description

I've hit a nasty and subtle bug in code using the deprecated Net::HTTPResponse to_ary conversion: https://github.com/joshfrench/rakismet/pull/17

Up to Ruby 1.9.2 the method generated a warning, but in 1.9.3 it's removed completely.

The problem is, array conversion still happened implicitly and without warnings, but the second variable (which should have been assigned with the response's body) did not get assigned at all.

I suggest redefining the method with an explicit exception to make this mistake less subtle.


Files

redefine-net-httpresponse-to_ary.diff (500 Bytes) redefine-net-httpresponse-to_ary.diff lshevtsov (Leonid Shevtsov), 04/22/2012 09:04 PM

Updated by naruse (Yui NARUSE) over 13 years ago Actions #1 [ruby-core:44531]

  • Status changed from Open to Rejected

It is not array conversion, but multiple assignment.

If this is suggested before 1.9.3, I maybe merged it.
But I won't merge this to 1.9.3 because this is not a bug fix.
And I won't merge this to 2.0 because it's already removed.
So I reject this.

Actions

Also available in: PDF Atom