View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
15802Bug reportsExpression Managerpublic2020-01-31 16:32
ReporterDenisChenu Assigned Toollehar  
PrioritynormalSeverityminor 
Status acknowledgedResolutionopen 
Product Version3.22.1 
Summary15802: Invalid warning string about numeric value
Description

The warning show with function and + operator are always «Usage of + with numeric value, see manual about usage of sum.» and never «Usage of + with string value»

Steps To Reproduce

Import included survey, check logic file

Additional Information

2 issues here :

  1. No different string for both numeric or not : https://github.com/LimeSurvey/LimeSurvey/blob/eba81f2ab24d2b2484d7b2b1d730df191b573aed/application/helpers/expressions/em_core_helper.php#L498-L505
  2. All function return 'NUMBER' : https://github.com/LimeSurvey/LimeSurvey/blob/eba81f2ab24d2b2484d7b2b1d730df191b573aed/application/helpers/expressions/em_core_helper.php#L2182
TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)3.22 and 4.10
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP Versionphp7.3

Relationships

related to 15803 acknowledgedollehar No warning shown when compare numeric with string function 

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2020-01-31 11:33

administrator   ~55577

Str concat instead of + ?

DenisChenu

DenisChenu

2020-01-31 12:02

developer   ~55578

Maybe :

bothnumeric :
«Usage of + with numeric value, see manual about usage of sum.»
Not bothnumeric
«Usage of + with string or numeric value, see manual about usage of sum and join.» *

I view this yesterday on a training instance about date. It's clearly string concat needed, but still talk to sum …

ollehar

ollehar

2020-01-31 12:51

administrator   ~55580

Warning text: "Please use concat() instead of '+' when concatenating two strings."

?

DenisChenu

DenisChenu

2020-01-31 14:15

developer   ~55589

Remind : when checking in logic file, you don't have real value …

Then for example : single choice Q1.NAOK return "" even if all choice are number :)

Then bothNumeric : yes sure at 100%, not bothnumeric … : maybe both numeric.

ollehar

ollehar

2020-01-31 15:13

administrator   ~55591

User should type-cast NAOK to int with parseInt().

DenisChenu

DenisChenu

2020-01-31 16:32

developer   ~55598

See the lss : even with
{"Here we must use " + "join"} it show : use sum.

I know user must use sum or join (no need intval …) , and we give him the advice … but seems strabnge to see use sum with {"Here we must use " + "join"}

Then : i think
bothnumeric : use sum
Else : use sum or join

Issue History

Date Modified Username Field Change
2020-01-31 08:43 DenisChenu New Issue
2020-01-31 08:43 DenisChenu File Added: limesurvey_survey_BadWarning.lss
2020-01-31 08:43 DenisChenu File Added: Capture d’écran du 2020-01-31 08-36-10.png
2020-01-31 08:47 DenisChenu Summary INvalid warning string about numeric value => Invalid warning string about numeric value
2020-01-31 08:47 DenisChenu Relationship added related to 15803
2020-01-31 11:33 ollehar Note Added: 55577
2020-01-31 12:02 DenisChenu Note Added: 55578
2020-01-31 12:51 ollehar Note Added: 55580
2020-01-31 12:52 ollehar Priority none => normal
2020-01-31 13:45 ollehar Assigned To => ollehar
2020-01-31 13:45 ollehar Status new => acknowledged
2020-01-31 14:15 DenisChenu Note Added: 55589
2020-01-31 15:13 ollehar Note Added: 55591
2020-01-31 16:32 DenisChenu Note Added: 55598