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

Escaping custom helper return even if returned in SafeString #286

Closed darkphoenixff4 closed 6 years ago

darkphoenixff4 commented 6 years ago

I have a custom helper that uses Aura\Html\Helpers\Title to control the title tag; the helper really just prints the string results of that class to the Handlebars page. However, even though I'm returning a SafeString to notify LightnCandy that the results should not be escaped, I'm still getting escaped HTML as the output.

Code:

` /**

($this->getTitle() simply returns the aforementioned Title object; the results of (string)$this->getTitle() is Text content unescaped)

The following flags are active: HANDLEBARS HANDLEBARSJS PROPERTY METHOD INSTANCE EXTHELPER THIS HBESCAPE JSOBJECT JSTRUE

darkphoenixff4 commented 6 years ago

I should have closed this earlier, but I sort of forgot; the actual issue is actually pretty simple to see if you look at the code closely - which I did afterwards. I'm setting the return value on the function to "string", forcing the SafeString to be cast... Which, of course, means that it'll be escaped. Sorry about this; I'll close the issue.