Commit Graph

730 Commits

Author SHA1 Message Date
Fabien Potencier 20249a0320 fixed CS 2015-11-02 15:44:22 +01:00
Fabien Potencier 52b8d992dc minor #1904 make cache per user (on linux) (remicollet)
This PR was merged into the 1.x branch.

Discussion
----------

make cache per user (on linux)

Just because I hate having failed test when I run test once on 1 account, then once on another account ;)

Commits
-------

da5cac6 make cache per user (on linux)
2015-11-02 15:44:00 +01:00
Remi Collet da5cac6b54 make cache per user (on linux) 2015-11-02 15:09:33 +01:00
Fabien Potencier e3a325f249 deprecated Twig_ExtensionInterface::getGlobals() 2015-10-29 16:13:49 -07:00
Fabien Potencier 72485c2ea0 deprecated the possibility to override an extension by registering another one with the same name 2015-10-27 22:04:22 -07:00
Fabien Potencier 847d48e790 feature #1886 deprecated Twig_ExtensionInterface::initRuntime() (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

deprecated Twig_ExtensionInterface::initRuntime()

I'm working on splitting Twig extensions into 2 different phases: compilation and runtime. The goal is to avoid having to load the runtime environment of an extension when compiling templates. That also opens the way to be able to lazy-load Twig extensions.

While working on the split, I realized that the `initRuntime()` method on `Twig_ExtensionInterface` is not needed anymore. It was added at a time `needs_environment` did not exist and was a way to keep the environment around for custom filters/tests/functions. But nowadays, that's not needed anymore. I did a quick search on Github, and most of the implementation I found just store the environment in a local property, which is not needed anymore. So, I propose to deprecate it in 1.x and remove it in 2.0.

Commits
-------

9774f4f deprecated Twig_ExtensionInterface::initRuntime()
2015-10-27 20:46:45 -07:00
Fabien Potencier 12ea20245c fixed message inconsistency 2015-10-26 19:17:27 +01:00
Fabien Potencier 9774f4f1a4 deprecated Twig_ExtensionInterface::initRuntime() 2015-10-25 15:48:46 +01:00
Fabien Potencier 0468a7ede4 feature #1890 deprecated Twig_Environment::computeAlternatives() (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

deprecated Twig_Environment::computeAlternatives()

Commits
-------

d0a5ef8 deprecated Twig_Environment::computeAlternatives()
2015-10-25 12:39:22 +01:00
Fabien Potencier d0a5ef8cc0 deprecated Twig_Environment::computeAlternatives() 2015-10-25 09:10:27 +01:00
Fabien Potencier 6ddd911aa5 minor #1891 made the tests semantically more correct (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

made the tests semantically more correct

Calling `initRuntime()` is just a side-effect of loading a template.

Commits
-------

f839ad3 made the tests semantically more correct
2015-10-25 08:16:08 +01:00
Fabien Potencier f839ad328e made the tests semantically more correct 2015-10-25 08:12:33 +01:00
Jérôme Tamarelle a57b1cc3be Fix adding mock extension to Twig environment
When the extension class is not defined in a file but in eval'd code
we cannot assume ReflectionObject::getFileName will return
a valid file path.

https://bugs.php.net/bug.php?id=63901
2015-10-23 13:31:04 +02:00
Fabien Potencier aa1596785b fixed CS 2015-10-08 17:08:17 +02:00
Fabien Potencier 3347b9040e minor #1846 Add test coverage for auto_reload (znerol)
This PR was squashed before being merged into the 1.x branch (closes #1846).

Discussion
----------

Add test coverage for auto_reload

Fixes #1841

Commits
-------

1769f84 Add test coverage for auto_reload
2015-10-04 10:31:01 +02:00
Lorenz Schori 1769f84a4d Add test coverage for auto_reload 2015-10-04 10:31:00 +02:00
Fabien Potencier ac718de74c minor #1845 Add unit tests for filesystem cache (znerol)
This PR was merged into the 1.x branch.

Discussion
----------

Add unit tests for filesystem cache

Fixes #1842

Commits
-------

40555fc Add test coverage for Twig_Cache_Filesystem
2015-10-04 10:30:00 +02:00
Tobias Schultze f379e8141c fix template class name generation to prevent possible collisions and one inode per file 2015-10-03 20:59:41 +02:00
David Négrier 6f84981ae6 Fix custom escaper null values 2015-09-30 14:05:05 +02:00
Lorenz Schori 40555fc16e Add test coverage for Twig_Cache_Filesystem 2015-09-21 16:03:23 +02:00
Nicolas Grekas f35a540b1f Prevent potential doc comments in escaped inlined source 2015-09-14 10:00:28 +02:00
Fabien Potencier 0bb7184a17 feature #1806 More flexible integration test (SpacePossum)
This PR was squashed before being merged into the 1.x branch (closes #1806).

Discussion
----------

More flexible integration test

replaces https://github.com/twigphp/Twig/pull/1805 as a 1.x version

Commits
-------

3f779f6 More flexible integration test
2015-09-13 18:59:35 +02:00
Possum 3f779f6b3a More flexible integration test 2015-09-13 18:59:34 +02:00
Fabien Potencier 5126cbff91 feature #1822 changed the arguments of generateKey (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

changed the arguments of generateKey

We now pass the template name and the template class, which seems much better from a UX standpoint.

Passing the prefix was really just a hack and an implementation leak to be able to determine the variable part of the class name and generate sub-directories for templates. Now, we generate the cache key by taking the last characters instead of the first ones, to avoid the need for the class prefix.

That should also make Drupal happy :)

Commits
-------

c2e75ff changed the arguments of generateKey
0157315 deprecated Twig_Environment::getTemplateClassPrefix
2015-09-12 19:42:00 +02:00
Fabien Potencier c2e75ff88a changed the arguments of generateKey 2015-09-12 15:34:55 +02:00
Fabien Potencier 550a384412 added enabled extension names in the generated template class names 2015-09-12 14:43:01 +02:00
Nicolas Grekas 7e666cba8d Fix inlining of sources with CRLF 2015-09-11 17:49:20 +02:00
Fabien Potencier cacfb069b2 added a cache interface for templates 2015-09-11 16:24:57 +02:00
Fabien Potencier 7cb4b945a4 feature #1813 Add $template->getSource() (nicolas-grekas)
This PR was merged into the 1.x branch.

Discussion
----------

Add $template->getSource()

Now that we have the source inlined, we should provide a way to get it. This also make it possible to feature-test if the source is available for backward/forward compat.

Commits
-------

de86850 Add $template->getSource()
2015-09-11 14:29:03 +02:00
Fabien Potencier 7e78fa584f fixed PHP 5.2 compt 2015-09-11 14:28:20 +02:00
Nicolas Grekas de86850bf7 Add $template->getSource() 2015-09-11 14:23:59 +02:00
Fabien Potencier 33917e87ae removed code that supports obsolete versions of PHP 2015-09-11 13:55:03 +02:00
Nicolas Grekas ff9afa0dc3 Fix test 2015-09-10 11:07:58 +02:00
Fabien Potencier 37c006f7a7 fixed 5.2 compat 2015-09-10 10:57:20 +02:00
Nicolas Grekas c9fb3730c2 Inline original source code in compiled templates 2015-09-10 10:50:55 +02:00
Fabien Potencier 542dd3acc0 feature #1795 Traversable support for 'replace', 'merge' and 'sort' (SpacePossum)
This PR was merged into the 1.x branch.

Discussion
----------

Traversable support for 'replace', 'merge' and 'sort'

Add traversable support to:
* replace
* merge
* sort

Other changes:
* Removes some not need checks
* ~~Make unit test skip if it cannot write to cache because of the user running the test~~
* Tests added for traversable support
* Doc updates

Deprecating:
I think the undocumented (and multibyte not supported) use of `replace(string, string)` can be removed in Twig 2.0.
Adding MB support and documentation of the feature was turned down (https://github.com/twigphp/Twig/pull/1618)
However removing it is a BC break (https://github.com/twigphp/Twig/pull/1445#issuecomment-48746926)

Commits
-------

2a17303 Mark test skipped if cannot write to cache directory.
2015-09-06 08:43:16 +02:00
Tobias Schultze e403363b1a fix escaping strategy detection based on filename 2015-08-31 14:50:02 +02:00
Possum 2a17303601 Mark test skipped if cannot write to cache directory.
Add Traversable support for replace, sort and merge filters.
2015-08-28 11:14:03 +02:00
Fabien Potencier 9561582e2f fixed support for Twig_Test_* classes 2015-08-26 10:26:15 +02:00
Fabien Potencier 05b5f80d4a simplified tests 2015-08-18 14:33:40 +02:00
Fabien Potencier cc980282de added deprecation notices for deprecated classes 2015-08-18 13:34:47 +02:00
Nicolas Grekas c6ab7de8f2 optimized legacy tests management 2015-08-18 13:34:47 +02:00
Fabien Potencier eebfdc75f1 added a way to manage legacy tests in fixtures 2015-08-18 13:34:47 +02:00
Fabien Potencier 8c4291ac08 removed usage of deprecated features, marked some tests as being legacy 2015-08-18 13:34:47 +02:00
Fabien Potencier 23c392212e added deprecated notices for deprecated features 2015-08-18 13:34:46 +02:00
Fabien Potencier 39885c9140 replaced obsolete raw tag by verbatim in tests 2015-08-15 23:50:57 +02:00
Christophe Coevoet a8a125ba9b Forbid access to the Twig environment from template instance
This also forbids access to other internal parts of the Twig_Template.
2015-08-12 17:44:05 +02:00
Fabien Potencier 30be07759a fixed sandbox security issue 2015-08-12 17:44:05 +02:00
Christophe Coevoet 7b6c0e971f Prevent importing or calling reserved macro names
This also fixes the logic detecting reserved macro names to account for
the fact that they are compiled prefixed with get() since a very long
time and the logic preventing conflicts was broken.
2015-08-12 17:44:05 +02:00
Fabien Potencier 5514c8ee80 deprecated _self 2015-08-12 11:08:46 +02:00