mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-05-03 10:33:08 +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 Behrooz Shabani <everplays@gmail.com>
|
||||||
* @author Dmitriy Simushev <simushevds@gmail.com>
|
* @author Dmitriy Simushev <simushevds@gmail.com>
|
||||||
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
|
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
|
||||||
|
* @author John Slegers <slegersjohn@gmail.com>
|
||||||
* @copyright 2014 Authors
|
* @copyright 2014 Authors
|
||||||
* @license MIT <http://opensource.org/licenses/MIT>
|
* @license MIT <http://opensource.org/licenses/MIT>
|
||||||
* @version GIT: $Id$
|
* @version GIT: $Id$
|
||||||
@ -31,6 +32,7 @@ use Handlebars\Template;
|
|||||||
* @author Behrooz Shabani <everplays@gmail.com>
|
* @author Behrooz Shabani <everplays@gmail.com>
|
||||||
* @author Dmitriy Simushev <simushevds@gmail.com>
|
* @author Dmitriy Simushev <simushevds@gmail.com>
|
||||||
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
|
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
|
||||||
|
* @author John Slegers <slegersjohn@gmail.com>
|
||||||
* @copyright 2014 Authors
|
* @copyright 2014 Authors
|
||||||
* @license MIT <http://opensource.org/licenses/MIT>
|
* @license MIT <http://opensource.org/licenses/MIT>
|
||||||
* @version Release: @package_version@
|
* @version Release: @package_version@
|
||||||
@ -59,7 +61,7 @@ class EachHelper implements Helper
|
|||||||
$template->setStopToken(false);
|
$template->setStopToken(false);
|
||||||
$buffer = $template->render($context);
|
$buffer = $template->render($context);
|
||||||
} elseif (is_array($tmp) || $tmp instanceof \Traversable) {
|
} 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;
|
$index = 0;
|
||||||
$lastIndex = $isList ? (count($tmp) - 1) : false;
|
$lastIndex = $isList ? (count($tmp) - 1) : false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user