Actions
Bug #13178
closedCGI.unescape change in behavior
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
Description
CGI.unescape does not work anymore when just "cgi/util" is required.
$ ruby -v -rcgi/util -e 'CGI.unescape("foo=bar&foo=baz&page=1")'
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
$ ruby -v -rcgi/util -e 'CGI.unescape("foo=bar&foo=baz&page=1")'
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
-e:1:in `unescape': uninitialized class variable @@accept_charset in #<Class:CGI> (NameError)
from -e:1:in `<main>'
It works just fine if whole "cgi" is required. Not sure if this is intentional or just side effect (probably due to r55540 or r54655 ?), but it breaks existing projects, e.g. httparty test suite fails due to this change:
1) HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER doesn't modify strings
Failure/Error: expect(CGI.unescape(query_string)).to eq("foo=bar&foo=baz")
NameError:
uninitialized class variable @@accept_charset in #<Class:CGI>
# ./spec/httparty/request_spec.rb:13:in `unescape'
# ./spec/httparty/request_spec.rb:13:in `block (3 levels) in <top (required)>'
Also please note that httparty does not require "cqi" at all. It is required via some transitive dependencies. Presumably via ERB 1. So in case that this is intentional behavior, ERB should require s|cgi/utils|cgi| IMO.
Actions
Like0
Like0Like0Like0