mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
3fbe8d8c469d8db70e6232f8c740130e5d07f4a1
Commits -------43ebae1Reset parsers, visitors, filters, tests, functions when a new one or new extension is added3db62daReset globals when a new global is added Discussion ---------- Reset globals when a new global is added if getGlobals() is called before adding a new global, it is never taken into account --------------------------------------------------------------------------- by fabpot at 2012-01-16T14:27:02Z Is it related to #594? --------------------------------------------------------------------------- by Seldaek at 2012-01-16T14:30:08Z Seems like it yes. It means that reading globals + writing + reading again will call getGlobals on all extensions again though. A slight improvement would be to cache the extension globals in another var that can be re-applied at once over the staged globals. The fastest would be to just set directly in ->globals if it's already initalized, but that means addGlobal can override extension globals. Not sure if that is a problem, but it creates a somewhat non-deterministic factor. I can adjust as required. --------------------------------------------------------------------------- by stof at 2012-01-16T14:45:49Z @Seldaek shouldn't the same be done for other methods (filters, functions, tags, tests and operators) ? --------------------------------------------------------------------------- by Seldaek at 2012-01-16T14:53:28Z Indeed, I was just focused on my crazy issue here :) Once @fabpot decides which way he prefers I can apply it to everything. --------------------------------------------------------------------------- by fabpot at 2012-01-16T21:05:19Z +1 for the the approach in this PR. @Seldaek: Can you apply it to everything else as well? Thanks. --------------------------------------------------------------------------- by Seldaek at 2012-01-17T00:54:08Z Done, also did it for adding and removing extensions since they potentially override stuff.
…
…
…
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.
More Information
Read the documentation for more information.
Description
Languages
PHP
99.9%