View Issue Details

IDProjectCategoryView StatusLast Update
14337Bug reports[All Projects] Expression Managerpublic2019-06-28 12:27
ReporterDenisChenu Assigned ToDenisChenu  
PriorityhighSeveritymajor 
Status resolvedResolutionfixed 
Product Version3.15.x 
Target VersionFixed in Version3.17.x 
Summary14337: Broken numeric interpretation of answer codes
Description

When comparing 2 question with numeric code : comparaison is done in alphanumeric in JS, and in numeric in PHP
This was not the case in 2.73 and before

Steps To Reproduce

Import included survey and test

Additional Information

With Q00 at 5 and Q01 at 20 : we can't go at next step : Mandatory question are hidden via javascript

TagsNo tags attached.
Complete LimeSurvey version number (& build)3.15.5 github
I will donate to the project if issue is resolvedNo
Browserff
Database & DB-Versionnot relevant ?
Server OS (if known)not relevant ?
Webserver software & version (if known)not relevant ?
PHP Versionnot relevant ?

Relationships

related to 07805 closedDenisChenu Comparaison String and Numeric is different in same page and other page 
related to 08324 closedDenisChenu Broken numeric interpretation of answer codes. 

Activities

DenisChenu

DenisChenu

2018-12-11 15:31

developer  

limesurvey_survey_CompareNumericCode.lss (19,115 bytes)
DenisChenu

DenisChenu

2019-01-25 10:07

developer   ~50303

@markusfluer : any new on this one ?

Currently a lot of EM system is broken due to your update of numeric system …

DenisChenu

DenisChenu

2019-06-05 07:55

developer   ~52300

https://github.com/LimeSurvey/LimeSurvey/pull/1289

DenisChenu

DenisChenu

2019-06-06 08:58

developer   ~52311

Sh … an older issue : 5+"" > 15+"" is compared as string in JS but as number in PHP.

Must fix this one too (and add a test)

DenisChenu

DenisChenu

2019-06-07 16:03

developer   ~52331

Proposition : with 20 (Q1) and 5 (Q2) for Answer code

  1. Q1 gt Q2 : true (true in PHP, false in JS) : compare as number. Related issue https://bugs.limesurvey.org/view.php?id=8324 since 2.05 , then think it must be (and in all condition : it must same in PHP and JS)
  2. Q1+"" gt Q2+"" : false (false in PHP, true in JS) : forced string : then compare as string : https://github.com/LimeSurvey/LimeSurvey/blob/5e262a6901848a03430d814bba8e9d55f3a239f9/application/helpers/expressions/em_core_helper.php#L324 (issue in PHP actually)
  3. Maybe see with intval(Q1+"")
  4. Maybe see with join(Q1,"") (must be set as string)

Add this to a tester



limesurvey_survey_checkCompareTestSurvey.lss (27,283 bytes)
DenisChenu

DenisChenu

2019-06-11 19:51

developer   ~52346

https://github.com/LimeSurvey/LimeSurvey/commit/63765d277d6293108006bb16bd9b96a834109971

DenisChenu

DenisChenu

2019-06-11 19:59

developer   ~52347

Still an issue … 3A on Q00 and 5 on Q01 return true for Q00+"" lt Q01+"" in JS because both are forced to string …

DenisChenu

DenisChenu

2019-06-28 12:27

developer   ~52634

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=29025

Related Changesets

LimeSurvey: master 63765d27

2019-06-11 19:07:30

DenisChenu


Committer: GitHub Details Diff
Fixed issue 14337: Comparaison String and Numeric is different in same page and other page

Dev: Fixed issue 08324: Broken numeric interpretation of answer codes.
Dev: If can be number : return a number in JS
Dev: JS with number+"" do a compare by string : then same for PHP
Dev: adding a Survey test
Affected Issues
08324, 14337
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - assets/scripts/expressions/em_javascript.js Diff File
add - tests/data/surveys/limesurvey_survey_checkCompareTestSurvey.lss Diff File
add - tests/helpers/JsPhpCompareTest.php Diff File

Issue History

Date Modified Username Field Change
2018-12-11 15:31 DenisChenu New Issue
2018-12-11 15:31 DenisChenu File Added: limesurvey_survey_CompareNumericCode.lss
2018-12-11 15:32 DenisChenu Relationship added related to 07805
2018-12-11 15:33 LouisGac Priority none => high
2018-12-11 15:34 DenisChenu Relationship added related to 08324
2019-01-10 16:23 LouisGac Assigned To => markusfluer
2019-01-10 16:23 LouisGac Status new => assigned
2019-01-25 10:07 DenisChenu Note Added: 50303
2019-04-25 19:27 DenisChenu Relationship added related to 14817
2019-04-26 09:07 DenisChenu Relationship deleted related to 14817
2019-06-05 07:55 DenisChenu Note Added: 52300
2019-06-06 08:57 DenisChenu Assigned To markusfluer => DenisChenu
2019-06-06 08:58 DenisChenu Note Added: 52311
2019-06-07 16:03 DenisChenu File Added: limesurvey_survey_checkCompareTestSurvey.lss
2019-06-07 16:03 DenisChenu Note Added: 52331
2019-06-11 19:51 DenisChenu Status assigned => resolved
2019-06-11 19:51 DenisChenu Resolution open => fixed
2019-06-11 19:51 DenisChenu Fixed in Version => 3.17.x
2019-06-11 19:51 DenisChenu Note Added: 52346
2019-06-11 19:59 DenisChenu Note Added: 52347
2019-06-13 11:36 DenisChenu Summary Comparaison String and Numeric is different in same page and other page => Broken numeric interpretation of answer codes
2019-06-28 12:27 DenisChenu Changeset attached => LimeSurvey master 63765d27
2019-06-28 12:27 DenisChenu Note Added: 52634