We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Codev Web>UrlParamFailsWhenZero (02 Aug 2002, PeterThoeny)
Tags:
create new tag
, view all tags

URLPARAM variable can't read a parameter of "0"

The result of "%URLPARAM{"TestVal"}%" should be "0" on a page with "?TestVal=0" in the url. But in fact it evaluates to the empty string "".

Test case

Click http://twiki.org/cgi-bin/view/Codev/UrlParamFailsWhenZero?TestVal=0 or http://twiki.org/cgi-bin/view/Codev/UrlParamFailsWhenZero?TestVal=1 and note the result: "".

The reason for this appears to be in handleUrlParam in TWiki.pm. The line that reads:

   $value = $cgiQuery->param( $theParam ) || "";
...should read...
   $value = $cgiQuery->param( $theParam );
   $value = "" if (! defined $value);

I see the || "" construction elsewhere in TWiki.pm, I wonder if this same bug might strike elsewhere?

Environment

TWiki version: 01 Dec 2001
TWiki plugins: N/A
Server OS: Windows 2000
Web server: Apache
Perl version: ActiveState 5.6.1
Client OS: Windows 2000
Web Browser: IE 5.50

-- GladeDiviney - 01 Aug 2002

Follow up

Fix record

Thanks for reporting and providing code. Is fixed, in TWikiAlphaRelease and at TWiki.org.

-- PeterThoeny - 02 Aug 2002

Topic revision: r3 - 02 Aug 2002 - 19:11:55 - PeterThoeny
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback