Skip to content

Commit

Permalink
N°5725 - Twig update 'filter', 'map' and 'reduce' filters
Browse files Browse the repository at this point in the history
  • Loading branch information
eespie committed Dec 8, 2022
1 parent ae94e58 commit cf433f2
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Closure;
use Dict;
use IssueLog;
use Twig\Extension\AbstractExtension;
use Twig_SimpleFilter;
use Twig_SimpleFunction;
Expand Down Expand Up @@ -103,16 +104,19 @@ function ($sStringCode, $sParam01 = null, $sParam02 = null, $sParam03 = null, $s
$filters[] = new Twig_SimpleFilter('filter', function ($array, $arrow) {
$ret = $this->SanitizeFilter($array, $arrow);
if ($ret !== false) {
IssueLog::Error('Twig "filter" filter has limited capabilities');
return [$ret];
}
return twig_array_filter($array, $arrow);
});
// Since 2.7.8 deactivate map
$filters[] = new Twig_SimpleFilter('map', function ($array, $arrow) {
IssueLog::Error('Twig "map" filter is deactivated');
return $array;
});
// Since 2.7.8 deactivate reduce
$filters[] = new Twig_SimpleFilter('reduce', function ($array, $arrow, $initial = null) {
IssueLog::Error('Twig "reduce" filter is deactivated');
return $array;
});

Expand Down

0 comments on commit cf433f2

Please sign in to comment.