You are here: Foswiki>Tasks Web>Item647 (25 Apr 2009, KennethLavrsen)Edit Attach

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

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.5
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: Foswiki:Main.KennethLavrsen
Waiting For: Main.KennethLavrsen
Last Change By: 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 Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy