View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|15405||Bug reports||Expression Manager||public||2019-10-15 11:32||2019-11-19 16:16|
|Summary||15405: Numerical vs alphabetical order in EM, <, >, vs strcmp etc|
"2" > "18" behaves differently in JS and PHP
The intuition behind "A2" > "A18" is wrong
Default answer code is A1. Press plus, and it become A10, A11, etc. Condition designer uses <, >, etc, but comparing "A2" < "A18" is probably not what user wants (instead "A02" < "A18" OR compare question order).
|Steps To Reproduce|
User had survey which broke. Mandatory question was hidden on client (browser) but "shown" on server, leading to mandatory violation BUT without any possibility to actually fill in the question. The origin of the problem was "2" > "18" (age compare).
Two commits (that were reverted):
|Tags||No tags attached.|
|Complete LimeSurvey version number (& build)||latest master|
|I will donate to the project if issue is resolved||No|
|Database & DB-Version||-|
|Server OS (if known)||-|
|Webserver software & version (if known)||-|
"2" > "18" is not really different (bvecause you can 't have it in JS)
With Q00 as single choice with number Q00 as 5 : Q00 < "10" is different in PHP and JS …
Maybe must be STRING for both ?
limesurvey_survey_jsphpIssueCompare.lss (18,722 bytes)
@ollehar : in my opinion : must separate the issue
PS : since 2.05 : my advice when compare number is always do intval(Q00) before ;)
But we agree: Warning (or error) when doing "18", e.g. [0-9]* in quote?
Yes : my opinion :
The A2 > A10 is another issue :)
Related: Lots of people (except Denis) agree answer codes should be numeric as default, not alphanumeric.
My real opinion : empty default answer code (for the 1st)
Same for subquestion code
@ollehar : can we list the real part wher it's broken : i mean compare is different between PHP and JS ?
"2" > "18" is different in PHP and JS.
But : did you have a Survey for this.
I know it's different, but since we have an hacked compare with PHP : maybe we can try to dix it .
I think i do an error :
For example (in JS)
Please, don't try to hack EM more - it's already too complex. The best solution is a warning message, IMO.
Not for this part : since code are already updated since some year now …
Again, I disagree. Writing < "18" is always a conceptual error from the users side.
Yes, it can be. But the biggest issue : JS must be same than PHP.
Since it's hard ( impossible ?) to fix
|2019-10-15 11:32||ollehar||New Issue|
|2019-10-15 11:34||ollehar||Steps to Reproduce Updated||View Revisions|
|2019-10-15 11:37||ollehar||Additional Information Updated||View Revisions|
|2019-10-15 11:38||DenisChenu||Note Added: 54044|
|2019-10-15 11:38||DenisChenu||Note Edited: 54044||View Revisions|
|2019-10-15 11:41||ollehar||Description Updated||View Revisions|
|2019-10-15 11:42||DenisChenu||File Added: limesurvey_survey_jsphpIssueCompare.lss|
|2019-10-15 11:43||DenisChenu||Note Added: 54045|
|2019-10-15 14:34||ollehar||Note Added: 54046|
|2019-10-15 14:37||DenisChenu||Note Added: 54047|
|2019-10-15 14:38||ollehar||Note Added: 54048|
|2019-10-15 14:41||DenisChenu||Note Added: 54049|
|2019-10-17 08:01||DenisChenu||Note Added: 54067|
|2019-10-17 10:27||ollehar||Note Added: 54072|
|2019-10-17 11:35||DenisChenu||Note Added: 54078|
|2019-10-17 11:36||DenisChenu||Note Added: 54079|
|2019-10-17 11:38||ollehar||Note Added: 54081|
|2019-10-17 11:41||DenisChenu||Note Added: 54082|
|2019-10-17 11:47||ollehar||Note Added: 54083|
|2019-10-17 12:45||DenisChenu||Note Added: 54087|
|2019-10-17 15:10||ollehar||Note Added: 54088|
|2019-10-31 10:20||DenisChenu||Relationship added||related to 15501|