Backward incompatibilities:
* The short notation of the `block` tag changed.
+ * fixed iterator_to_array() usage
* changed the date filter to support any date format supported by DateTime
* added ignore_invalid_variables setting to throw an exception when an invalid variable is used in a template (disabled automatically when debug is true)
* added the lexer, parser, and compiler as arguments to the Twig_Environment constructor
} elseif (is_string($compare)) {
return false !== strpos($compare, (string) $value);
} elseif (is_object($compare) && $compare instanceof Traversable) {
- return in_array($value, iterator_to_array($compare));
+ return in_array($value, iterator_to_array($compare, false));
}
return false;
}
}
-function twig_iterator_to_array($seq)
+function twig_iterator_to_array($seq, $useKeys = true)
{
if (is_array($seq)) {
return $seq;
} elseif (is_object($seq) && $seq instanceof Traversable) {
- return $seq instanceof Countable ? $seq : iterator_to_array($seq);
+ return $seq instanceof Countable ? $seq : iterator_to_array($seq, $useKeys);
} else {
return array();
}