mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 07:56:07 +01:00
fix for filterFunc and mapFunc
Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
@@ -1745,6 +1745,10 @@ class GravExtension extends AbstractExtension implements GlobalsInterface
|
||||
throw new RuntimeError('Twig |filter("' . $arrow . '") is not allowed.');
|
||||
}
|
||||
|
||||
if ($array === null) {
|
||||
$array = [];
|
||||
}
|
||||
|
||||
return twig_array_filter($env, $array, $arrow);
|
||||
}
|
||||
|
||||
@@ -1761,6 +1765,10 @@ class GravExtension extends AbstractExtension implements GlobalsInterface
|
||||
throw new RuntimeError('Twig |map("' . $arrow . '") is not allowed.');
|
||||
}
|
||||
|
||||
if ($array === null) {
|
||||
$array = [];
|
||||
}
|
||||
|
||||
return twig_array_map($env, $array, $arrow);
|
||||
}
|
||||
|
||||
@@ -1777,6 +1785,10 @@ class GravExtension extends AbstractExtension implements GlobalsInterface
|
||||
throw new RuntimeError('Twig |reduce("' . $arrow . '") is not allowed.');
|
||||
}
|
||||
|
||||
if ($array === null) {
|
||||
$array = [];
|
||||
}
|
||||
|
||||
return twig_array_map($env, $array, $arrow);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user