Twig
Twig copied to clipboard
json_encode does not work in last version of Twig
{{'test'|json_encode}} - this construction works as expected.
{% filter json_encode %} test {% endfilter %}
but this construction returns just {}.
I've added a fix in my fork, markstory@affc21f4d63d2d9e6e6a. The issue seemed to be caused by the filter block using a Twig_Markup instance as the output. json_encode converted this into {}.
fixed
Is it really fixed? I don't see code from @markstory here https://github.com/fabpot/Twig/blob/master/lib/Twig/Extension/Core.php#L51 . And sometimes we have more complex occurrence, when Twig_Markup is item of array.