View Issue Details

IDProjectCategoryView StatusLast Update
12975Development Survey Designpublic2018-02-19 15:06
ReportertpartnerAssigned Totpartner 
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version3.x 
Target VersionFixed in Version3.x 
Summary12975: Cannot use the twig split filter
Description

@LouisGac, can we safely add this to the sandbox allowed functions?

I tried adding "split" to the functions array in internal.php at line 265 but still got a "Twig_Sandbox_SecurityNotAllowedFilterError" when using something like below:

<code>{% set foo = aGroup.name|split('-') %}</code>

Reference - https://twig.symfony.com/doc/2.x/filters/split.html

TagsNo tags attached.

Activities

LouisGac

LouisGac

2017-11-29 10:40

manager   ~45183

sure Tony, feel free to do it and to push it.
if you need assistance, just ask me in the IRC

tpartner

tpartner

2017-11-29 12:33

developer   ~45184

Thanks Louis.

I have pushed the change but can't test right now as my extended theme was a child of "default" which seems to have been removed.

LouisGac

LouisGac

2017-11-29 12:38

manager   ~45187

ok I'll have a look.

tpartner

tpartner

2017-11-30 14:07

developer   ~45207

Okay, I have tested with an extension of the bootswatch theme and still get the error when trying to use something like:

<code>{% set foo = aGroup.name|split('-') %}</code>

tpartner

tpartner

2018-02-13 23:59

developer   ~46427

Hi Louis, did the split function ever get added? I don't see it in internal.php and cannot use it in Twig files.

tpartner

tpartner

2018-02-14 00:05

developer   ~46428

While we're at it, can we also add Trim - https://twig.symfony.com/doc/2.x/filters/trim.html ?

LouisGac

LouisGac

2018-02-14 10:24

manager   ~46431

sure, I'll do it today

tpartner

tpartner

2018-02-15 00:51

developer   ~46496

Do you want me to push a commit?

LouisGac

LouisGac

2018-02-15 10:43

manager   ~46503

arf I forgot sorry :(
yep you can push a commit if you want

tpartner

tpartner

2018-02-15 13:24

developer   ~46518

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

tpartner

tpartner

2018-02-15 13:26

developer   ~46520

No worries, this was a want-to-have, not a need-to-have. :)

Please review the commit.

ollehar

ollehar

2018-02-19 15:06

administrator   ~46583

Implemented in 3.4.0.

Related Changesets

LimeSurvey: master e004cf1a

2018-02-15 13:12:57

tpartner

Details Diff
Fixed issue 12975: Cannot use the twig split filter
Dev: Added split and filter functions
Affected Issues
12975
mod - application/config/internal.php Diff File

LimeSurvey: master e4b847a3

2018-02-15 13:24:21

tpartner

Details Diff
Fixed issue 12975: Cannot use the twig split filter
Dev: Added split and filter functions
Affected Issues
12975
mod - application/config/internal.php Diff File

Issue History

Date Modified Username Field Change
2017-11-28 20:53 tpartner New Issue
2017-11-28 20:53 tpartner Status new => assigned
2017-11-28 20:53 tpartner Assigned To => LouisGac
2017-11-28 20:54 tpartner Description Updated View Revisions
2017-11-28 20:56 tpartner Description Updated View Revisions
2017-11-28 20:56 tpartner Description Updated View Revisions
2017-11-28 20:57 tpartner Description Updated View Revisions
2017-11-28 21:07 tpartner Description Updated View Revisions
2017-11-29 10:40 LouisGac Note Added: 45183
2017-11-29 12:33 tpartner Note Added: 45184
2017-11-29 12:38 LouisGac Note Added: 45187
2017-11-30 14:07 tpartner Note Added: 45207
2018-02-13 23:59 tpartner Note Added: 46427
2018-02-14 00:05 tpartner Note Added: 46428
2018-02-14 10:24 LouisGac Note Added: 46431
2018-02-15 00:51 tpartner Note Added: 46496
2018-02-15 10:43 LouisGac Note Added: 46503
2018-02-15 13:24 tpartner Changeset attached => LimeSurvey master e004cf1a
2018-02-15 13:24 tpartner Changeset attached => LimeSurvey master e4b847a3
2018-02-15 13:24 tpartner Note Added: 46518
2018-02-15 13:24 tpartner Assigned To LouisGac => tpartner
2018-02-15 13:24 tpartner Resolution open => fixed
2018-02-15 13:26 tpartner Note Added: 46520
2018-02-19 15:06 ollehar Status assigned => resolved
2018-02-19 15:06 ollehar Fixed in Version => 3.x
2018-02-19 15:06 ollehar Note Added: 46583
2018-02-19 15:06 ollehar Status resolved => closed