B
Brian Candler
Hmm, something has changed in CGI which has broken an application - sorry I
didn't have a chance to test/comment on this before 1.8.0 was released, but
anyway here's the information now.
@cgi['foo'][0] used to return nil if parameter 'foo' was not supplied by the
user. It now returns empty string; so does @cgi['foo']
This is a bit of a problem, since I have code which says
if @cgi['foo'][0]
.. do stuff if parameter 'foo' is supplied
end
in lots of places. But in any case, surely "parameter is missing" should be
represented by nil, since the condition "parameter is present but is an
empty string" is different?
The solution I have found is
if @cgi.params['foo'][0]
..
endif
But that seems to be rather against the spirit of the change to the cgi.rb
module, which was supposed to make accessing parameters *easier*, not more
convoluted...
Cheers,
Brian.
didn't have a chance to test/comment on this before 1.8.0 was released, but
anyway here's the information now.
@cgi['foo'][0] used to return nil if parameter 'foo' was not supplied by the
user. It now returns empty string; so does @cgi['foo']
This is a bit of a problem, since I have code which says
if @cgi['foo'][0]
.. do stuff if parameter 'foo' is supplied
end
in lots of places. But in any case, surely "parameter is missing" should be
represented by nil, since the condition "parameter is present but is an
empty string" is different?
The solution I have found is
if @cgi.params['foo'][0]
..
endif
But that seems to be rather against the spirit of the change to the cgi.rb
module, which was supposed to make accessing parameters *easier*, not more
convoluted...
Cheers,
Brian.