You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes Vector and Map are both traversable and they also implement the \IteratorAggregate interface which end up in the following infinite loop
while ($item instanceof \IteratorAggregate) { $item = $item->getIterator(); }
because the getIterator of Vector/Map always return an \IteratorAggregate.
But I don't understand this while loop because nothing say that this while loop will end.
Well, in userland, you cannot have an infinite loop there, because at some point, you need to reach a place actually implementing the iteration protocol. But for extensions, they might be able to override the iteration protocol without actually implementing Iterator.
We use ext-ds object in twig files and the slice/first or last filters get stuck when using it on Vector or Map.
Exemple:
{% set result = myVector|last %}
This is due to the following while loop in the twig_slice function (https://github.com/twigphp/Twig/blob/3.x/src/Extension/CoreExtension.php#L651):
And because
$item->getIterator()
return a Vector which implement \IteratorAggregate.I don't know if it can be fixed ?
Thank you in advance for your help
The text was updated successfully, but these errors were encountered: