ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:79378] [Ruby trunk Bug#13178] CGI.unescape change in behavior
       [not found] <redmine.issue-13178.20170201111858@ruby-lang.org>
@ 2017-02-01 11:18 ` v.ondruch
  2017-02-02  1:34 ` [ruby-core:79385] " nobu
  1 sibling, 0 replies; 2+ messages in thread
From: v.ondruch @ 2017-02-01 11:18 UTC (permalink / raw
  To: ruby-core

Issue #13178 has been reported by Vit Ondruch.

----------------------------------------
Bug #13178: CGI.unescape change in behavior
https://bugs.ruby-lang.org/issues/13178

* Author: Vit Ondruch
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
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.


[1]: https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L15



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:79385] [Ruby trunk Bug#13178] CGI.unescape change in behavior
       [not found] <redmine.issue-13178.20170201111858@ruby-lang.org>
  2017-02-01 11:18 ` [ruby-core:79378] [Ruby trunk Bug#13178] CGI.unescape change in behavior v.ondruch
@ 2017-02-02  1:34 ` nobu
  1 sibling, 0 replies; 2+ messages in thread
From: nobu @ 2017-02-02  1:34 UTC (permalink / raw
  To: ruby-core

Issue #13178 has been updated by Nobuyoshi Nakada.

Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

It's an older bug than it.

```
$ ruby2.1 -rcgi -e 'CGI.accept_charset = "ISO-8859-15"; p CGI.unescape("foo").encoding'
#<Encoding:UTF-8>
```

There are different `@@accept_charset` variables.

----------------------------------------
Bug #13178: CGI.unescape change in behavior
https://bugs.ruby-lang.org/issues/13178#change-62813

* Author: Vit Ondruch
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
* Backport: 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
----------------------------------------
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.


[1]: https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L15



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-02  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-13178.20170201111858@ruby-lang.org>
2017-02-01 11:18 ` [ruby-core:79378] [Ruby trunk Bug#13178] CGI.unescape change in behavior v.ondruch
2017-02-02  1:34 ` [ruby-core:79385] " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).