View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
06330Bug reportsExpression Managerpublic2012-07-19 20:34
Reporterdanielf Assigned ToTMSWhite  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.92+ 
Fixed in Version1.92+ 
Summary06330: Regex engine does not accept a leading zero even if explicitly specified as acceptable
Description

Regex validation fails when a text input is validated against an expression with a leading zero (e.g. the "Australian postcodes" regex - /^[0-9]{4}/ in the official documentation - would fail if the response starts with a zero).

Steps To Reproduce

1.) Define a free text entry question
2.) Limit max length to 4 characters
3.) Apply /^[0-9]{4}/ as validation expression
4.) Test the question in a submittable survey, and enter any number with a leading zero as answer

The answer would not validate.

Additional Information

I have also noticed, that not limiting the answer length to the number of characters implied by the regex, after surpassing this implied limit, the regex would match (resulting in an illegal answer). E.g. typing anything as a 5th digit would satisfy the regex.

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)120711
I will donate to the project if issue is resolvedNo
BrowserGoogle Chrome
Database type & versionMySQL 5.5
Server OS (if known)CentOS 5.8
Webserver software & version (if known)Apache 2.22
PHP Version5.3.14

Users monitoring this issue

There are no users monitoring this issue.

Activities

TMSWhite

TMSWhite

2012-07-18 15:54

reporter   ~19761

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

TMSWhite

TMSWhite

2012-07-18 15:54

reporter   ~19762

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

c_schmitz

c_schmitz

2012-07-18 16:33

administrator   ~19774

1.92+ version released.

TMSWhite

TMSWhite

2012-07-19 20:34

reporter   ~19812

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

Related Changesets

LimeSurvey: master e60f4f74

2012-07-18 06:52:16

TMSWhite

Details Diff
Fixed issue 06330: Regex engine does not accept a leading zero even if explicitly specified as acceptable
Dev core problem was that LEMval() was casting [0-9]+ to a number, so would strip off leading zeros. Now, if has leading zeros, they will be kept.
Affected Issues
06330
mod - scripts/em_javascript.js Diff File

LimeSurvey: Yii a5247c5f

2012-07-18 06:53:05

TMSWhite

Details Diff
Fixed issue 06330: Regex engine does not accept a leading zero even if explicitly specified as acceptable
Dev core problem was that LEMval() was casting [0-9]+ to a number, so would strip off leading zeros. Now, if has leading zeros, they will be kept.
Affected Issues
06330
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: Yii 79ae6416

2012-07-19 11:33:12

TMSWhite

Details Diff
Fixed issue 06330: Regex engine does not accept a leading zero even if explicitly specified as acceptable
Dev fixed use of strlen(value) instead of value.length which caused EM unit tests to fail.
Affected Issues
06330
mod - scripts/expressions/em_javascript.js Diff File

Issue History

Date Modified Username Field Change
2012-07-17 02:08 danielf New Issue
2012-07-17 02:08 danielf Status new => assigned
2012-07-17 02:08 danielf Assigned To => TMSWhite
2012-07-18 15:54 TMSWhite Changeset attached => LimeSurvey master e60f4f74
2012-07-18 15:54 TMSWhite Note Added: 19761
2012-07-18 15:54 TMSWhite Resolution open => fixed
2012-07-18 15:54 TMSWhite Changeset attached => LimeSurvey Yii a5247c5f
2012-07-18 15:54 TMSWhite Note Added: 19762
2012-07-18 15:55 TMSWhite Status assigned => resolved
2012-07-18 15:55 TMSWhite Fixed in Version => 1.92+
2012-07-18 16:33 c_schmitz Note Added: 19774
2012-07-18 16:33 c_schmitz Status resolved => closed
2012-07-19 20:34 TMSWhite Changeset attached => LimeSurvey Yii 79ae6416
2012-07-19 20:34 TMSWhite Note Added: 19812