• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7278: %IF% interprets "0" as "undef" instead of a number and can't recognize single character variable name

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed   major 6.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

'0 < $ t and $ t < 1000' causes a syntax error

The following IF{...}% causes an error: Syntax error in '0 < $ t and $ t < 1000' at ' < $ t and $ t < 1000'
%IF{"0 < $ t and $ t < 1000" then="true" else="false"}%
Result: false

%IF{"(0 < $ t) and ($ t < 1000)" then="true" else="false"}%
Result: false

'-1 > 0' is true

The following IF{...} is expanded to true though false is expected.
%IF{"-1 > 0" then="true" else="false"}%
Result: false

-- TWiki:Main/HideyoImazu - 2013-06-06

Tests:

  • "0 < $ t and $ t < 1000": false
  • "0 < $ t": false
  • "0 < $ tt": false
  • "0 < $ ttt": false
  • "0 < 1 and 1 < 1000": true
  • "(0 < $ t) AND ($ t < 1000)": false
  • "(0 < 1) AND (1 < 1000)": true

More tests:

  • "0 > -1": true
  • "0 < -1": false
  • "0 > 1": false
  • "0 < 1": true
  • "-1 < 0": true
  • "-1 > 0": false
  • "1 < 0": false
  • "1 > 0": true

-- Peter Thoeny - 2013-06-20

Issue with first bug: The parser does not grok single letter variable names.

-- TWiki:Main.PeterThoeny - 2013-06-20

  1. IF statement interprets "0" as "undef" instead of a numberic character. In result, all the comparison against "0" is actually comparing with "undef".
  2. One letter variable name triggers unexpected syntax error is a defect from regex.

-- TWiki:Main.YaojunFei - 2013-09-06

ItemTemplate
Summary %IF% interprets "0" as "undef" instead of a number and can't recognize single character variable name
ReportedBy TWiki:Main.HideyoImazu
Codebase

SVN Range TWiki-5.1.3-trunk, Tue, 04 Jun 2013, build 25988
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:26281 TWikirev:26282
TargetRelease major
ReleasedIn 6.0.0
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r10 - 2013-10-15 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback