Twig
Twig copied to clipboard
Twig, the flexible, fast, and secure template language for PHP
If I do: `sub.twig`: ```twig {% extends 'main.twig' %} world Hello! ``` with `main.twig`: ```twig {% block main %} Hello world! {% endblock %} ``` I get the error: >...
Twig's default `html` escaping strategy will double encode whatever entities are present in the original source. This is the expected default behavior of `htmlspecialchars` which is used under the hood....
Hi, I'm using Twig 2.14.4 with PHP 8.0.3 in CMS. Template snippet: `'You have % z new comments' | format( newCommentCount )` If user has error in input of `format`...
Hello, this is more a feature request than an issue. What about adding the spread operator as a replacement/addition to the merge filter? We could improve the readability of the...
Sometimes an embed only needs one block, and it would be nice if we could shorten this: ```twig {% embed 'widget' %} {% block content %} Content here {% endblock...
```twig {{ include('foo.twig', {123: true}) }} {# OR #} {{ include('foo.twig', {"123": true}) }} {# foo.twig #} {{ dump(_context) }} ``` >array:1 [▼ 0 => true ]
Using `flashbag.get` in a `?:` ternary operator doesn't work consistently with how PHP handles ternary operators. For example, `{% set form_data = app.session.flashbag.get('form_data') ?: default_data %}`, where `form_data` is populated,...
For example, to prevent XSS, I would use this: ``` $Parsedown->setSafeMode(true); ``` Source: https://github.com/erusev/parsedown#security But using the `markdown_to_html` filter, I don't see how would I use it. _Yes, I can...
Alternative implementation of #934. Works well for methods, properties and array calls of objects with minimal performance impact. Results of twig benchmark ([fabpot/twig-perf](https://github.com/fabpot/twig-perf)): ``` | v1.12.3 | v1.16.3 | origin/master...
Fixes: - Configure sandbox for method `__call`. - Call enabled method with name same as property.