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://www.twiki.org/cgi-bin/view/Codev/UrlParamFailsWhenZero?TestVal=0 or http://www.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 - 2002-08-02 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.