Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
15501Bug reportsExpression Managerpublic2021-03-10 23:03
ReporterAlbanCatry Assigned Toollehar  
PrioritynoneSeverityminor 
Status closedResolutionnot fixable 
Product Version3.19.2 
Summary15501: relevanceStatus : different evaluation in JS and PHP
Description

When comparing SomeQuestion.relevanceStatus to an integer (eg SomeQuestion.relevanceStatus == 0 or SomeQuestion.relevanceStatus == 1) and use it in a future relevance equation, the answers may be displayed and not be saved.

Steps To Reproduce

An example .lss file is here : https://www.limesurvey.org/forum/can-i-do-this-with-limesurvey/119540-using-relevancestatus-in-relevance-equations-of-further-questions

Additional Information

I am using LimeSurvey Professional and I don't know how to get Database and PHP version

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)3.9.3
I will donate to the project if issue is resolvedNo
Browser
Database type & versionunknown
Server OS (if known)
Webserver software & version (if known)
PHP Versionunknown

Relationships

related to 15405 closedollehar Bug reports Numerical vs alphabetical order in EM, <, >, vs strcmp etc 
related to 07805 closedDenisChenu Bug reports Comparaison String and Numeric is different in same page and other page 
related to 12613 closedollehar Bug reports Condition NAOK >= " " (no answer) evaluated differently in JS/PHP 
related to 15532 closedDenisChenu Feature requests Show warnings when implicit alphabetical compare is used in expressions 

Activities

DenisChenu

DenisChenu

2019-10-31 10:19

developer   ~54296

Here the 2 surveys ,

@ollehar : The issue is (again) a compare difference between JS and PHP
BUT : this time with == false == 0 in js but not with PHP ?

ollehar

ollehar

2019-11-01 10:03

administrator   ~54307

Thanks, have to make another test for this.

DenisChenu

DenisChenu

2019-11-01 10:52

developer   ~54314

Remind NAOK >= &quot; &quot; is near not fixable …

ollehar

ollehar

2019-11-01 12:58

administrator   ~54317

Why would you use ">=" in such a case? Should be == or !=

ollehar

ollehar

2019-11-01 12:58

administrator   ~54318

But again: Using >, <, ... on string should give warning.

DenisChenu

DenisChenu

2019-11-01 13:02

developer   ~54319

@ollehar : using ! is OK here. It's not the point on the way to fix … see the limesurvey_survey_relevanceStatusCompareFixedOK.lss file
(!Q2_SQ001.relevanceStatus and !Q2_SQ002.relevanceStatus) is the best way ( relevanceStatus is a boolean)

The point is : it must be same in PHP and JS :).
With >= etc … we already try fixing it. But not with == :)

ollehar

ollehar

2019-11-01 13:08

administrator   ~54320

The point is : it must be same in PHP and JS :).

Impossible without a virtual machine, and NOT enough! Feel free to try, though. But personally I feel more motivated to do a warning system.

Will check the surveys.

ollehar

ollehar

2019-11-01 13:19

administrator   ~54321

PS. A virtual machine can be a very small piece of code: https://github.com/GedRap/xs-vm

Instead of generating JS, the EM could pass tokens to the browser which are then evaluated the same way as in PHP. DS.

DenisChenu

DenisChenu

2020-01-07 17:34

developer   ~55142

Instead of generating JS, the EM could pass tokens to the browser which are then evaluated the same way as in PHP. DS.

The develop version of Sam Moussa some year ago do JS in ajax : then NO difference between JS and PHP : all is done with PHP . Most easy to create new function : only PHP needed etc … etc …

:D

Issue History

Date Modified Username Field Change
2019-10-31 09:57 AlbanCatry New Issue
2019-10-31 10:19 DenisChenu File Added: limesurvey_survey_relevanceStatusCompareFixedOK.lss
2019-10-31 10:19 DenisChenu File Added: limesurvey_survey_relevanceStatusCompareKO.lss
2019-10-31 10:19 DenisChenu Note Added: 54296
2019-10-31 10:20 DenisChenu Relationship added related to 15405
2019-10-31 10:21 DenisChenu Relationship added related to 07805
2019-10-31 10:21 DenisChenu Relationship added related to 12613
2019-11-01 10:03 ollehar Note Added: 54307
2019-11-01 10:52 DenisChenu Note Added: 54314
2019-11-01 12:58 ollehar Note Added: 54317
2019-11-01 12:58 ollehar Note Added: 54318
2019-11-01 13:02 DenisChenu Note Added: 54319
2019-11-01 13:08 ollehar Note Added: 54320
2019-11-01 13:19 ollehar Note Added: 54321
2019-11-08 15:54 DenisChenu Relationship added related to 15532
2020-01-07 15:39 jelo Issue Monitored: jelo
2020-01-07 17:34 DenisChenu Note Added: 55142
2021-03-10 23:03 ollehar Assigned To => ollehar
2021-03-10 23:03 ollehar Status new => closed
2021-03-10 23:03 ollehar Resolution open => not fixable
2021-08-02 16:13 guest Bug heat 4 => 6