cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
You are here: Foswiki>Tasks Web>Item569 (08 Jan 2009, KwangErnLiew)Edit Attach

Item569: ENCODE turns the value 0 into empty string ''

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.0
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: Foswiki:Main.KennethLavrsen
Waiting For:
Last Change By: KwangErnLiew
In Item5453 a general issue is raised which is that some macros are not handling the value 0 as a string but as the value false.

This causes for example ENCODE to convert 0 to ''

As Sven rightfully says this can be a can of worms.

But I believe the best is to take them one at a time - and take the first one as the one that seems to have caused problems already in reports.

And the 5453 reports the ENCODE as the problem

I could not follow up with unit tests etc and other may follow up. I think a simple little comment in the code where I fix it will prevent the bug from coming back.

I will checkin the school book fix for how to handle a variable that can be 0.

The general way is

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

I create this bug report so I can put it Waiting for Release and get the happy news about ENCODE in the release note.

If I check in on 5453 I cannot close the bug and it will not be in the release note.

-- KennethLavrsen - 25 Dec 2008

ItemTemplate edit

Summary ENCODE turns the value 0 into empty string ''
ReportedBy Foswiki:Main.KennethLavrsen
Codebase trunk
SVN Range TWiki-4.2.3, Wed, 06 Aug 2008, build 17396
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins
TargetRelease patch
ReleasedIn 1.0.0
Topic revision: r2 - 08 Jan 2009, KwangErnLiew - This page was cached on 20 Jun 2018 - 15:55.

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