Project

General

Profile

Bug #14793

Hash returned from CGI.parse has [] as default value

Added by avit (Andrew Vit) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:87290]

Description

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.

History

Updated by avit (Andrew Vit) about 1 year ago

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

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

Please close.

#3

Updated by naruse (Yui NARUSE) about 1 year ago

  • Status changed from Open to Closed

Also available in: Atom PDF