View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
10860Bug reportsOtherpublic2018-09-28 14:12
Reporterfvanderstarre Assigned ToDenisChenu  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version2.06+ 
Fixed in Version2.50.x 
Summary10860: Regular expression fail (2.06+)
Description

I have a short text question where I want people to enter "+" or "-" followed by a number (three digits max), or zero. The regular expression I built to validate works OK when I test it on https://regex101.com/, but not in LimeSurvey it seems. There, any number entered after "+" except zero(es), is rejected.
Regex used: "/^0|((+|-)[0-9]{1,3})$/"

Steps To Reproduce

Create short text question with input box width 4 and max chars 4.
Enter regex "/^0|((+|-)[0-9]{1,3})$/" for validation.
See attached survey lss file.

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)2.06+ build 160129
I will donate to the project if issue is resolvedNo
BrowserFirefox/Chrome
Database type & versionMS SQL server 2008R2 10.50.6220 (X64)
Server OS (if known)DB server: Windows NT 6.1 <X64> build 7601 SP1
Webserver software & version (if known)Linux RHEL 7, Apache 2.4.6
PHP Version5.6.19

Relationships

related to 11620 closedmarkusfluer Validation equation bug 
related to 11731 closedollehar JavaScript error when the field has a validation regexp, and the input starts with a plus sign 
related to 11894 closedmarkusfluer Regex validation not working as expected when leading zeros are present in short text questions 
child of 08324 closedDenisChenu Broken numeric interpretation of answer codes. 

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2016-04-11 12:23

administrator   ~37208

This works fine in 2.50.

DenisChenu

DenisChenu

2016-04-11 13:54

developer   ~37219

@c_schmitz : you are sure ? Tested see screenshot.

DenisChenu

DenisChenu

2016-04-11 14:12

developer   ~37220

Did someone know why we force NON numeric question type to numeric here
https://github.com/LimeSurvey/LimeSurvey/blob/master/scripts/expressions/em_javascript.js#L739

We already test if it's numeric :
https://github.com/LimeSurvey/LimeSurvey/blob/master/scripts/expressions/em_javascript.js#L678

DenisChenu

DenisChenu

2016-04-12 13:31

developer   ~37261

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

DenisChenu

DenisChenu

2016-04-13 08:56

developer   ~37278

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

DenisChenu

DenisChenu

2016-04-13 10:04

developer   ~37281

Fix committed to 2.06lts branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=18499

DenisChenu

DenisChenu

2016-04-13 10:12

developer   ~37282

This fix whole "string" to "number" for non numeric question type.

Think other system are not broken with this fix .

c_schmitz

c_schmitz

2016-04-15 10:24

administrator   ~37421

Version 2.50+ Build 160415 released

DenisChenu

DenisChenu

2018-09-28 14:12

developer   ~49183

Fix committed to 2.06lts branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&amp;id=28078

Related Changesets

LimeSurvey: master 16a95712

2016-04-12 11:10:37

DenisChenu

Details Diff
Fixed issue 10860 : Regular expression fail with specific value
Dev: before 01 return a string and 1 a number
Dev : now (if question is not numeric) : +1, 30 number, 01 .0 return string
Dev: still issue with big number (but with big number : even when forcing to number : sum is broken).
Affected Issues
10860
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: master 8c6ed4e4

2016-04-13 06:56:21

DenisChenu

Details Diff
Merge pull request #474 from Shnoulle/master_fix10860

Fixed issue 10860 : Regular expression fail with specific value
- Time to comment is closed. Tested, update a little the system, but seems better (hope)
Affected Issues
10860
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: 2.06lts 163878fb

2016-04-13 08:04:05

DenisChenu

Details Diff
Fixed issue 10860 : Regular expression fail with specific value
Dev: same fix than master, and some space removed ....
Dev: before 01 return a string and 1 a number
Dev : now (if question is not numeric) : +1, 30 number, 01 .0 return string
Dev: still issue with big number (but with big number : even when forcing to number : sum is broken).
Affected Issues
10860
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: 2.06lts 3279a102

2016-04-13 10:04:05

DenisChenu

Details Diff
Fixed issue 10860 : Regular expression fail with specific value
Dev: same fix than master, and some space removed ....
Dev: before 01 return a string and 1 a number
Dev : now (if question is not numeric) : +1, 30 number, 01 .0 return string
Dev: still issue with big number (but with big number : even when forcing to number : sum is broken).
Affected Issues
10860
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

Issue History

Date Modified Username Field Change
2016-04-04 08:58 fvanderstarre New Issue
2016-04-04 08:58 fvanderstarre File Added: limesurvey_survey_491491.lss
2016-04-11 12:23 c_schmitz Note Added: 37208
2016-04-11 13:37 DenisChenu Assigned To => DenisChenu
2016-04-11 13:37 DenisChenu Status new => assigned
2016-04-11 13:54 DenisChenu Note Added: 37219
2016-04-11 13:54 DenisChenu File Added: Capture du 2016-04-11 13-53-46.png
2016-04-11 14:12 DenisChenu Note Added: 37220
2016-04-11 14:26 DenisChenu Relationship added child of 08324
2016-04-12 13:31 DenisChenu Note Added: 37261
2016-04-13 08:56 DenisChenu Changeset attached => LimeSurvey master 16a95712
2016-04-13 08:56 DenisChenu Changeset attached => LimeSurvey master 8c6ed4e4
2016-04-13 08:56 DenisChenu Note Added: 37278
2016-04-13 08:56 DenisChenu Resolution open => fixed
2016-04-13 10:04 DenisChenu Changeset attached => LimeSurvey 2.06lts 163878fb
2016-04-13 10:04 DenisChenu Note Added: 37281
2016-04-13 10:12 DenisChenu Note Added: 37282
2016-04-13 10:12 DenisChenu Status assigned => resolved
2016-04-13 10:12 DenisChenu Fixed in Version => 2.5
2016-04-13 12:24 Mazi Relationship added related to 10934
2016-04-13 12:34 DenisChenu Relationship deleted related to 10934
2016-04-15 10:24 c_schmitz Note Added: 37421
2016-04-15 10:24 c_schmitz Status resolved => closed
2016-09-03 18:45 DenisChenu Relationship added related to 11620
2016-10-02 16:25 DenisChenu Relationship added related to 11731
2016-11-13 17:21 DenisChenu Relationship added related to 11894
2018-09-28 14:12 DenisChenu Changeset attached => LimeSurvey 2.06lts 3279a102
2018-09-28 14:12 DenisChenu Note Added: 49183