Issue #14793 has been updated by avit (Andrew Vit).


My mistake, it looks like all CGI values are always returned as arrays:

~~~
CGI.parse("x=y")
#=> {"x"=>["y"]}
~~~

Please close.

----------------------------------------
Bug #14793: Hash returned from CGI.parse has [] as default value
https://bugs.ruby-lang.org/issues/14793#change-72288

* Author: avit (Andrew Vit)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
Is there a valid reason for this behaviour? It looks like a bug to me:

~~~
require 'cgi'

params = CGI.parse("")
params["x"]
#=> []
~~~

(Expected nil)

I looked at history and it looks like it has been there from the very beginning of cgi.rb.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>