XaminProject / handlebars.php

Handlebars processor for php
331 stars 132 forks source link

Helper try to execute another helper even that it's inside quotes #158

Closed jcubic closed 8 years ago

jcubic commented 8 years ago

I have better if helper that evaluate arbitrary expressions using expression.php and I've tried to execute this template:

        {{#if "$content =~ \"/^([li].*)/\""}}
           match: {{$1}}
        {{/if}}

and get error:

Fatal error: Uncaught InvalidArgumentException: Unknown helper: "[li].*" in /handlebars.php/src/Handlebars/Helpers.php:143

actually I have {{#if $content =~ "/^([li].*)/"}} and add quotes around the expression before calling render method.

jcubic commented 8 years ago

Looking at source code of Template.php helpers are executed if they are in double quotes, I've changed it to single quote and it works.