Closed EGreg closed 8 years ago
Could you make a snippet to reproduce it?
We even have test coverage for each
helper and associative arrays which is passing: https://github.com/XaminProject/handlebars.php/blob/33ec96a1b415f945a5fd833e5234ac1dfbfe08bb/tests/Xamin/HandlebarsTest.php#L242-L246
My apologies, the issue applied to an earlier version of this library. I pulled the new code and it was fixed.
However, you can see (as a vestige) the mismatch between EachHelper->execute expecting $args to be an array, but then it's actually a string, and calling $context->get($args) with it.
You can close this issue.
The problem:
A template which includes an
{{#each}}
construct iterating over some non-empty associative array renders non-empty results in JS handlebars implementations, but renders an empty result in this XaminProject PHP implementation.Notes:
The problem originates here:
The
EachHelper->execute(...)
function expects$args
to be an array, but then you call$context->get($args)
which which expects the first parameter to be a string instead of an array. As a result,$tmp
is empty and you dotemplate->discard()
which skips over the entire#each
construct.