Foswiki on GitHub is open for business! Next release meeting: Monday October 13, 1300Z

Item647: You cannot SEARCH for the Value of "0"

Priority: CurrentState: AppliesTo: Component: WaitingFor:
Normal Closed Engine   Main.KennethLavrsen
Value of "0" need to be reviewed that it correctly gets treated as the string "0" and not the value FALSE in SEARCH and METASEARCH

I do not have any actual example that it does not work but during the walkthrough of the Foswiki macros in Item5453 it was identified that the search macros may have potential problems.

It was also identified that any changes are risky and a fix needs to be done with great care and peer reviewing.

So the scope of any fix is AFTER 1.0.0 release because of the risk (high) vs actual impact of the problem (low)

See Item5453 for the discussion and also the code suggested

ie

$a = $b || '';

must be replaced by

$a = defined ( $b ) ? $b : '';

in the cases where $b can be the string "0" and be the string zero and not FALSE.

I am willing to analyse this one more after 1.0.0 release so I put it being worked on for myself.

-- KennethLavrsen - 03 Jan 2009

I went carefully through this a while ago and finished it today.

The SEARCH cannot find the value 0. And it cannot handle the format string "0"

For all other parameters to SEARCH the value 0 makes no sense so no need to add additional code execusion to handle that (example a webname 0 makes no sense at all)

I have fixed both.

The METASEARCH only has one parameter where a 0 makes sense and that is the value. And it is handled correctly. No fix needed for METASEARCH.

-- KennethLavrsen - 25 Apr 2009

ItemTemplate edit

Summary You cannot SEARCH for the Value of "0"
ReportedBy Foswiki:Main.KennethLavrsen
Codebase 1.0.5 beta1, 1.0.4, trunk
SVN Range Foswiki-1.0.0-beta3, Fri, 02 Jan 2009, build 1697
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor KennethLavrsen
Checkins distro:271134631997 distro:c7f5846df242 distro:da117cc66934 distro:ad8d46c9a51c
TargetRelease patch
ReleasedIn 1.0.5
Topic revision: r7 - 25 Apr 2009, KennethLavrsen
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License