Issue #14793 has been updated by tonytonyjan (Wei-Hang Jian).


FYI: https://github.com/ruby/ruby/blob/fef8339f582b125e1fec5f3d47adbb48f7cede92/lib/cgi/core.rb#L393

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

* 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>