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) almost 14 years ago. Updated almost 14 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
Actions

Also available in: PDF Atom