zordius / lightncandy

An extremely fast PHP implementation of handlebars ( http://handlebarsjs.com/ ) and mustache ( http://mustache.github.io/ ),
https://zordius.github.io/HandlebarsCookbook/
MIT License
610 stars 76 forks source link

Mustache / PHP on Windows not behaving as expected. #283

Closed jkosoy closed 7 years ago

jkosoy commented 7 years ago

This feels like a longshot to post here! 👀

I'm deploying an application on Azure (running on Windows / PHP 7.1.8) that requires Mustache parsing. I've got my flags set as follows:

LightnCandy::FLAG_MUSTACHE | LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_ERROR_LOG | LightnCandy::FLAG_BESTPERFORMANCE

The data I'm passing looks as follows:

$data = [
  'label' => 'Label',
  'navItems' => [
   ['label' => 'Nav Label 1'],
   ['label' => 'Nav Label 2']
  ]
]

And here's a basic demo template I'm attempting to compile:

<p>Here's a variable named label: {{ label }}</p>

<hr>

<p>Now here are items objects with a variable named label in them.</p>

<ul>
{{# navItems }}
   {{# label }}
    <li>{{ label }}</li>
   {{ /label }}
{{/ navItems }}
</ul>

When I test using a basic MAMP configuration this performs as expected - I get two list items that display "Nav Label 1", "Nav Label 2" respectively. However on Windows the two list items appear as "Label", "Label" -- effectively it looks like wrapping everything in a conditional check returns me back to the global scope.

It seems crazy to me that the issue would be the compiled php.exe, but is that possible?

jkosoy commented 7 years ago

Nevermind. I got it. The box needed to be 64bit. Go team!