Skip to content

Commit

Permalink
fix block param for #each on Object case
Browse files Browse the repository at this point in the history
  • Loading branch information
zordius committed Mar 23, 2018
1 parent 8850d93 commit 21f791e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Runtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public static function sec($cx, $v, $bp, $in, $each, $cb, $else = null) {
$raw = static::m($cx, $raw, array($bp[0] => $raw));
}
if (isset($bp[1])) {
$raw = static::m($cx, $raw, array($bp[1] => $cx['sp_vars']['index']));
$raw = static::m($cx, $raw, array($bp[1] => $index));
}
$ret[] = $cb($cx, $raw);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/regressionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,15 @@ public function issueProvider()
'expected' => 'ab'
),

Array(
'template' => '{{#each . as |v k|}}#{{k}}{{/each}}',
'data' => Array('a' => Array(), 'c' => Array()),
'options' => Array(
'flags' => LightnCandy::FLAG_HANDLEBARS
),
'expected' => '#a#c'
),

Array(
'template' => '{{testNull null undefined 1}}',
'data' => 'test',
Expand Down

0 comments on commit 21f791e

Please sign in to comment.