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
https://www.twiki.org/cgi-bin/view/Codev/UrlParamFailsWhenZero?TestVal=0 or
https://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