fix for filterFunc and mapFunc

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller
2025-10-20 11:14:33 -06:00
parent f9f3b9a8ba
commit c10acd1837

View File

@@ -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);
}
}