View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
10934Bug reportsExpression Managerpublic2016-04-15 10:24
ReporterMazi Assigned ToDenisChenu  
PrioritynoneSeveritycrash 
Status closedResolutionfixed 
Product Version2.06+ 
Target Version2.06+Fixed in Version2.06+ 
Summary10934: EM regexMatch function don't show pattern error and different behaviour in JS and PHP
Description

For a multiple short text question I was using the EM question validation feature to make sure the ZIP code entered at a certain sub-question uses 5 digits only.
For this I am using the regexMatch() function and theoretically that works well: The help text I added turns from red to green when entering e.g. 55555.
BUT: At survey runtime I still get the "One or more questions have not been answered in a valid manner" error.

Even when adjusting the regex to check that a field is not empty (/.\S./), the same error shows up.

Steps To Reproduce
  1. Import the attached survey and activate it.
  2. Run the survey.
  3. Enter a valid ZIP code like 55555
    -> You can't proceed
Additional Information

I just tested using the latest 2.06LTS version which includes a fix for https://bugs.limesurvey.org/view.php?id=10860 but that didn't help.

The same issue shpws up using LS 2.50.

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)LS206LTS 2016-04-13
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionMySQL 5
Server OS (if known)Ubuntu
Webserver software & version (if known)Apache 2
PHP Version5.5.9

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2016-04-13 12:24

updater   ~37302

Denis, I am assigning this to you since you had just fixed a similar issue (10860).
Please let me know if you need any additional information.

Mazi

Mazi

2016-04-13 12:26

updater   ~37303

I couldn't update the "I will donate to the project if issue is resolved" setting but I will donate once this was fixed.

DenisChenu

DenisChenu

2016-04-13 12:33

developer   ~37307

Donate to me ?

DenisChenu

DenisChenu

2016-04-13 12:35

developer   ~37308

Not same issue, then remove the link. It's surely a bug between JS regexp and PHP regexp

DenisChenu

DenisChenu

2016-04-13 12:37

developer   ~37309

regexMatch('/^[0-9]{5}$/',Validation2_03) work

Mazi

Mazi

2016-04-13 12:40

updater   ~37311

I can either donate to the project or to you or both, whatever you prefer.

Thanks for providing the additional regex. I really wonder why that makes a difference...?!

DenisChenu

DenisChenu

2016-04-13 12:49

developer   ~37313

Unknown modifier ']'

http://www.sondages.pro/brouillon/

You're regexp have an issue an / must be preceded by \

But this must be shown in Validate EM

DenisChenu

DenisChenu

2016-04-13 12:57

developer   ~37316

OK :

in PHP : try reg_match($pattern.'u', $input); then "/.../.../" return false
in JS : reg = new RegExp(pattern.substr(1,pattern.length-2));

Then remove first / and last /

2 fix to do :

  • Add the pattern error in Validate logic
  • return false if there are an issue with pattern before removing the / .
DenisChenu

DenisChenu

2016-04-13 13:56

developer   ~37325

PS: Uploaded fixed lss file.

DenisChenu

DenisChenu

2016-04-13 16:26

developer   ~37344

1st part : show the error : https://github.com/LimeSurvey/LimeSurvey/pull/475

DenisChenu

DenisChenu

2016-04-14 09:27

developer   ~37361

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

DenisChenu

DenisChenu

2016-04-14 10:24

developer   ~37369

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

DenisChenu

DenisChenu

2016-04-14 11:57

developer   ~37374

Wont fix the JS/PHP difference actually.

c_schmitz

c_schmitz

2016-04-15 10:24

administrator   ~37412

Version 2.50+ Build 160415 released

Related Changesets

LimeSurvey: master 4b5ef24d

2016-04-13 14:19:28

DenisChenu

Details Diff
Fixed issue 10934: EM regexMatch function don't show pattern error
Dev: add a geterrors_$funcName possibility to all function
Affected Issues
10934
mod - application/helpers/expressions/em_core_helper.php Diff File

LimeSurvey: master 3c60ab01

2016-04-14 07:26:58

DenisChenu

Details Diff
Merge pull request #475 from Shnoulle/master_fix10934_errorreturn

Fixed issue 10934: EM regexMatch function don't show pattern error
Affected Issues
10934
mod - application/helpers/expressions/em_core_helper.php Diff File

LimeSurvey: 2.06lts e559a200

2016-04-14 08:24:20

DenisChenu

Details Diff
Fixed issue 10934: EM regexMatch function don't show pattern error
Dev: add a geterrors_$funcName possibility to all function
Dev: lts support by external unpaid dev
Affected Issues
10934
mod - application/helpers/expressions/em_core_helper.php Diff File

Issue History

Date Modified Username Field Change
2016-04-13 12:23 Mazi New Issue
2016-04-13 12:23 Mazi Status new => assigned
2016-04-13 12:23 Mazi Assigned To => DenisChenu
2016-04-13 12:23 Mazi File Added: limesurvey_survey_377849.lss
2016-04-13 12:24 Mazi Relationship added related to 10860
2016-04-13 12:24 Mazi Note Added: 37302
2016-04-13 12:25 Mazi Additional Information Updated
2016-04-13 12:25 Mazi Reproducibility have not tried => always
2016-04-13 12:26 Mazi Note Added: 37303
2016-04-13 12:33 DenisChenu Note Added: 37307
2016-04-13 12:34 DenisChenu Relationship deleted related to 10860
2016-04-13 12:35 DenisChenu Note Added: 37308
2016-04-13 12:37 DenisChenu Note Added: 37309
2016-04-13 12:40 Mazi Note Added: 37311
2016-04-13 12:49 DenisChenu Note Added: 37313
2016-04-13 12:53 DenisChenu File Added: limesurvey_survey_regexp_fix.lss
2016-04-13 12:54 DenisChenu Summary EM regexMatch function prevents user to go to next screen though validation is true => EM regexMatch function have different behaviour in JS and PHP
2016-04-13 12:57 DenisChenu Note Added: 37316
2016-04-13 13:56 DenisChenu Note Added: 37325
2016-04-13 16:26 DenisChenu Note Added: 37344
2016-04-14 09:27 DenisChenu Changeset attached => LimeSurvey master 4b5ef24d
2016-04-14 09:27 DenisChenu Changeset attached => LimeSurvey master 3c60ab01
2016-04-14 09:27 DenisChenu Note Added: 37361
2016-04-14 09:27 DenisChenu Resolution open => fixed
2016-04-14 09:34 DenisChenu Summary EM regexMatch function have different behaviour in JS and PHP => EM regexMatch function don't show pattern error and different behaviour in JS and PHP
2016-04-14 10:24 DenisChenu Changeset attached => LimeSurvey 2.06lts e559a200
2016-04-14 10:24 DenisChenu Note Added: 37369
2016-04-14 11:57 DenisChenu Note Added: 37374
2016-04-14 11:57 DenisChenu Status assigned => resolved
2016-04-14 11:57 DenisChenu Fixed in Version => 2.06+
2016-04-15 10:24 c_schmitz Note Added: 37412
2016-04-15 10:24 c_schmitz Status resolved => closed