View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
16273 | Bug reports | Conditions | public | 2020-05-14 13:19 | 2020-08-12 11:11 |
Reporter | aquigar | Assigned To | gabrieljenik | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 3.22.15 | ||||
Summary | 16273: Validation regex including unicode characters fails | ||||
Description | I´m testing this simple regex to validate the content of an user response: /^[A-Z0-9\s]+$/ It matches capital letters, numbers and whitespaces. It seems to be correct and works fine. But assume I would like to include the unicode char "á". I've tested the following regexes with no results: /^[áA-Z0-9\s]+$/ /^[\x00E1A-Z0-9\s]+$/ /^[\x{00E1}A-Z0-9\s]+$/ /^[\u00E1A-Z0-9\s]+$/ 0x00E1 is the hex code value for "á" Tha validation test fails in all the cases above | ||||
Steps To Reproduce | Using a test survey, apply this validation regex to any response field and test... | ||||
Tags | No tags attached. | ||||
Bug heat | 12 | ||||
Complete LimeSurvey version number (& build) | 3.22.15+200505 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | mysql Ver 15.1 Distrib 10.1.24-MariaDB, for Linux (x86_64) using readline 5.1 | ||||
Server OS (if known) | Red Hat Enterprise Linux Server release 7.3 (Maipo) | ||||
Webserver software & version (if known) | |||||
PHP Version | 7.1.5 | ||||
related to | 16531 | closed | gabrieljenik | Validation regex including unicode characters fails |
Forum info: https://forums.limesurvey.org/forum/design-issues/121205-validation-regex-including-unicode-characters |
|
OK, so what if use decodeHtml or htmlspecialchars_decode for html decoding the "within" parameter in the LEMRegexMatch function. Comments? |
|
@DenisChenu What do you think? |
|
Are you sure it work ? My opinion is : Why not https://locutus.io/php/pcre/preg_match/ directly … Maybe start by remove gimy modifier … |
|
PS : still wait a stable 4.X to create some own function (for example : a real word counter …) |
|
Decoding html before running regex. This (a decode string) is similar to what the PHP side regex function gets. |
|
Tested the issue before pulling the PR, Issue exist. Tested the issue after pulling the PR, below are my findings: /^[\x{00E1}A-Z0-9\s]+$/ /^[\u00E1A-Z0-9\s]+$/ Screenshot 1: Includes scenarios where there is no Unicode included and with "á" Unicode Please refer the attachment for more details |
|
Actually the codes mentioned above where wrong , I tried giving as below : ^[\xE1A-Z0-9\s]+$ Working as expected |
|
Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=30366 |
|
Fixed in Release 3.23.0+200813 |
|
LimeSurvey: 3.x-LTS f35f77b0 2020-08-10 17:45 Committer: GitHub Details Diff |
Fixed issue 16273 - Validation regex including unicode characters fails (#1499) Decoding html before running regex. This (a decode string) is similar to what the PHP side regex function gets. |
Affected Issues 16273 |
|
mod - assets/scripts/expressions/em_javascript.js | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-05-14 13:19 | aquigar | New Issue | |
2020-05-14 14:29 | cdorin | Priority | none => normal |
2020-05-14 14:29 | cdorin | Status | new => confirmed |
2020-05-14 14:29 | cdorin | Zoho Sprints | => |Yes| |
2020-05-14 14:30 |
|
Zoho Sprints ID | => 14469000000091001 |
2020-05-14 14:30 | cdorin | Note Added: 57786 | |
2020-07-21 21:17 | gabrieljenik | Note Added: 59028 | |
2020-07-22 17:25 | gabrieljenik | Note Added: 59049 | |
2020-07-22 17:38 | DenisChenu | Note Added: 59050 | |
2020-07-22 17:39 | DenisChenu | Note Added: 59051 | |
2020-07-23 10:08 | vkuzmin | Issue Monitored: vkuzmin | |
2020-07-28 02:20 | gabrieljenik | Issue cloned: 16531 | |
2020-07-28 02:20 | gabrieljenik | Relationship added | related to 16531 |
2020-07-28 02:28 | gabrieljenik | Note Added: 59113 | |
2020-08-06 14:36 |
|
Note Added: 59342 | |
2020-08-06 14:36 |
|
File Added: 16273_BeforePR.png | |
2020-08-06 14:36 |
|
File Added: 16273_AfterPR.png | |
2020-08-07 16:50 |
|
Note Added: 59374 | |
2020-08-10 16:11 | gabrieljenik | Changeset attached | => LimeSurvey 3.x-LTS f35f77b0 |
2020-08-10 16:11 | gabrieljenik | Note Added: 59394 | |
2020-08-10 16:11 | gabrieljenik | Assigned To | => gabrieljenik |
2020-08-10 16:11 | gabrieljenik | Resolution | open => fixed |
2020-08-10 16:36 |
|
Zoho Sprints | Yes => |Yes| |
2020-08-10 16:36 |
|
Status | confirmed => resolved |
2020-08-12 11:11 | lime_release_bot | Zoho Sprints | Yes => |Yes| |
2020-08-12 11:11 | lime_release_bot | Note Added: 59437 | |
2020-08-12 11:11 | lime_release_bot | Status | resolved => closed |
2021-08-03 04:11 | guest | Bug heat | 10 => 12 |