mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-03-23 08:51:23 +03:00
Update EachHelper.php
For arrays that contain only one element, `(array_keys($tmp) == range(0, count($tmp) - 1)` always returns true. `(array_keys($tmp) === range(0, count($tmp) - 1)` works as expected.
This commit is contained in:
parent
3c58c8eeed
commit
c28709eb76
@ -59,7 +59,7 @@ class EachHelper implements Helper
|
||||
$template->setStopToken(false);
|
||||
$buffer = $template->render($context);
|
||||
} elseif (is_array($tmp) || $tmp instanceof \Traversable) {
|
||||
$isList = is_array($tmp) && (array_keys($tmp) == range(0, count($tmp) - 1));
|
||||
$isList = is_array($tmp) && (array_keys($tmp) === range(0, count($tmp) - 1));
|
||||
$index = 0;
|
||||
$lastIndex = $isList ? (count($tmp) - 1) : false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user