View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
09785Bug reportsExpression Managerpublic2015-07-24 11:44
ReporterDenisChenu Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.06+ 
Fixed in Version2.06+ 
Summary09785: substr and utf8 : mb_substr in JS , substr in PHP
Description

Using substr(QCODE,0,2) EM are different in js and in PHP with utf8 caracter

Steps To Reproduce

Import survey and test:
Like mb_substr in JS, substr in PHP

Additional Information

Think user want mb_substr and not substr then i think replace substr my mb_substr in EM core.

Another solution : fix substr in js to use real substr (surely in phpJS) and add an mb_substr EM function.

TagsNo tags attached.
Attached Files
Bug heat4
Complete LimeSurvey version number (& build)150718
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionnot relevant
Server OS (if known)debian/linux
Webserver software & version (if known)apache
PHP VersionPHP Version 5.4.41-0+deb7u1

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2015-07-18 14:04

developer   ~32719

Last edited: 2015-07-18 14:04

@Mazi : you think it's better to silently replace substr by UTF8 mb_substr or to add a new function ?

PS: give me after, i fix it before next release

DenisChenu

DenisChenu

2015-07-18 17:21

developer   ~32720

Same with strlen / surely stripos, strtolower ....

DenisChenu

DenisChenu

2015-07-20 14:23

developer   ~32724

Last edited: 2015-07-20 14:23

@Carsten : i have already the fix to move sustr/strlen etc ... to mb function. Think all user want this, and JS have already near mb system. Ok to move it o mb function ?
Else : i add new function in EM : mb_substr/mb_strlen AND fix js function to broken UTF8 .... (not sure find the way to return same string (see phpJS solution))

c_schmitz

c_schmitz

2015-07-20 20:06

administrator   ~32727

I agree. PLease replace!

DenisChenu

DenisChenu

2015-07-21 11:04

developer   ~32731

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

DenisChenu

DenisChenu

2015-07-21 11:09

developer   ~32732

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

DenisChenu

DenisChenu

2015-07-21 11:10

developer   ~32733

Think i have all here ?

c_schmitz

c_schmitz

2015-07-24 11:44

administrator   ~32781

Version 2.06 Build 150723 released

Related Changesets

LimeSurvey: master c031c7d2

2015-07-21 08:58:59

DenisChenu

Details Diff
New feature 09785: unicode function for substr and other text management function
Dev: mb_ for substr,stripos,strpos,strlen,strtolower,strtoupper,strstr,stristr
Dev: fixed different return value for strpos in JS and PHP (-1 in js, false in PHP)
Dev: add offset to strpos (exiting in stripos, not in strpos)
Affected Issues
09785
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: develop 0fe2cf79

2015-07-21 08:58:59

DenisChenu

Details Diff
New feature 09785: unicode function for substr and other text management function
Dev: mb_ for substr,stripos,strpos,strlen,strtolower,strtoupper,strstr,stristr
Dev: fixed different return value for strpos in JS and PHP (-1 in js, false in PHP)
Dev: add offset to strpos (exiting in stripos, not in strpos)
Dev: cherry-picking
Affected Issues
09785
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: master d1e02b28

2015-07-21 09:30:51

DenisChenu

Details Diff
Dev: Fixed issue PHP notice with debug 2 using offset in strpos
Dev: child of 09785
Affected Issues
09785
mod - application/helpers/expressions/em_core_helper.php Diff File

LimeSurvey: develop 22940f54

2015-07-21 09:30:51

DenisChenu

Details Diff
Dev: Fixed issue PHP notice with debug 2 using offset in strpos
Dev: child of 09785
Affected Issues
09785
mod - application/helpers/expressions/em_core_helper.php Diff File

Issue History

Date Modified Username Field Change
2015-07-18 14:03 DenisChenu New Issue
2015-07-18 14:03 DenisChenu File Added: limesurvey_survey_substr.lss
2015-07-18 14:04 DenisChenu Note Added: 32719
2015-07-18 14:04 DenisChenu Assigned To => Mazi
2015-07-18 14:04 DenisChenu Status new => feedback
2015-07-18 14:04 DenisChenu Note Edited: 32719
2015-07-18 17:21 DenisChenu Note Added: 32720
2015-07-18 17:21 DenisChenu Status feedback => assigned
2015-07-18 17:21 DenisChenu Status assigned => feedback
2015-07-20 14:21 DenisChenu Assigned To Mazi => c_schmitz
2015-07-20 14:21 DenisChenu Status feedback => assigned
2015-07-20 14:23 DenisChenu Note Added: 32724
2015-07-20 14:23 DenisChenu Note Edited: 32724
2015-07-20 20:06 c_schmitz Note Added: 32727
2015-07-20 20:06 c_schmitz Assigned To c_schmitz => DenisChenu
2015-07-21 11:04 DenisChenu Changeset attached => LimeSurvey master c031c7d2
2015-07-21 11:04 DenisChenu Note Added: 32731
2015-07-21 11:04 DenisChenu Resolution open => fixed
2015-07-21 11:09 DenisChenu Changeset attached => LimeSurvey develop 0fe2cf79
2015-07-21 11:09 DenisChenu Note Added: 32732
2015-07-21 11:10 DenisChenu Note Added: 32733
2015-07-21 11:10 DenisChenu Status assigned => resolved
2015-07-21 11:10 DenisChenu Fixed in Version => 2.06+
2015-07-21 11:10 DenisChenu File Added: limesurvey_survey_mbfunction.lss
2015-07-21 11:11 DenisChenu File Deleted: limesurvey_survey_substr.lss
2015-07-21 11:21 DenisChenu File Deleted: limesurvey_survey_mbfunction.lss
2015-07-21 11:21 DenisChenu File Added: limesurvey_survey_mbfunction.lss
2015-07-21 11:34 DenisChenu Changeset attached => LimeSurvey develop 22940f54
2015-07-21 11:34 DenisChenu Changeset attached => LimeSurvey master d1e02b28
2015-07-24 11:44 c_schmitz Note Added: 32781
2015-07-24 11:44 c_schmitz Status resolved => closed