mirror of
https://github.com/Mibew/handlebars.php.git
synced 2024-11-15 08:44:12 +03:00
Merge pull request #66 from jslegers/master
Fix for detecting assocc arrays with one item as list
This commit is contained in:
commit
bc56af2e83
@ -10,6 +10,7 @@
|
||||
* @author Behrooz Shabani <everplays@gmail.com>
|
||||
* @author Dmitriy Simushev <simushevds@gmail.com>
|
||||
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
|
||||
* @author John Slegers <slegersjohn@gmail.com>
|
||||
* @copyright 2014 Authors
|
||||
* @license MIT <http://opensource.org/licenses/MIT>
|
||||
* @version GIT: $Id$
|
||||
@ -31,6 +32,7 @@ use Handlebars\Template;
|
||||
* @author Behrooz Shabani <everplays@gmail.com>
|
||||
* @author Dmitriy Simushev <simushevds@gmail.com>
|
||||
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
|
||||
* @author John Slegers <slegersjohn@gmail.com>
|
||||
* @copyright 2014 Authors
|
||||
* @license MIT <http://opensource.org/licenses/MIT>
|
||||
* @version Release: @package_version@
|
||||
@ -59,7 +61,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