mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-31 04:27:00 +00:00
Validate the input of CoreExtension::map()
This commit is contained in:
@@ -1833,6 +1833,10 @@ final class CoreExtension extends AbstractExtension
|
||||
*/
|
||||
public static function map(Environment $env, $array, $arrow)
|
||||
{
|
||||
if (!is_iterable($array)) {
|
||||
throw new RuntimeError(\sprintf('The "map" filter expects a sequence/mapping or "Traversable", got "%s".', get_debug_type($array)));
|
||||
}
|
||||
|
||||
self::checkArrowInSandbox($env, $arrow, 'map', 'filter');
|
||||
|
||||
$r = [];
|
||||
|
||||
Reference in New Issue
Block a user