diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 9d6dd1a..31af066 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -545,10 +545,14 @@ public function renderVar($arg) { * The strings joined together. */ public function safeJoin(\Twig_Environment $env, $value, $glue = '') { + if ($value instanceof \Traversable) { + $value = iterator_to_array($value, false); + } + return implode($glue, array_map(function($item) use ($env) { // If $item is not marked safe then it will be escaped. return $this->escapeFilter($env, $item, 'html', NULL, TRUE); - }, $value)); + }, (array) $value)); } }