mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 19:06:40 +00:00
0ef96f6b1ddd2b395ab6476482fb4461e4036ec2
Commits -------5b91f12Update testsa5ef326Use Template->getContext in non-strict mode too Discussion ---------- Use Template->getContext() when in non-strict mode, too As described in #380 using the current `isset($context['test']) ? $context['test'] : null` approach can cause problems in some cases: The ternary operator always returns by value and thus PHP's copy-on-write concept does not apply. So `$context['test']` needs to be copied in any case, even though a write never happens to it. Basically Twig is copying the values of all variables ever used inside Twig if it operates in non-strict mode. This is problematic when `$context['test']` contains big arrays as the whole array is copied. In this patch I change Twig to use `Template->getContext` when in non-strict mode too and add an `isStrictVariables` check in there.
…
…
…
Twig, the flexible, fast, and secure template language for PHP
Twig is a template language for PHP, released under the new BSD license (code and documentation).
Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment.
Description
Languages
PHP
99.9%