Commit Graph

2646 Commits

Author SHA1 Message Date
Andrew Tch 04cc7e469d Implemented filesystem cache, one and only (see #1415) 2015-09-11 14:30:23 +02:00
Fabien Potencier 8af7659e3f updated CHANGELOG 2015-09-11 14:30:09 +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 788870ec34 minor #1815 removed code that supports obsolete versions of PHP (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

removed code that supports obsolete versions of PHP

Commits
-------

33917e8 removed code that supports obsolete versions of PHP
2015-09-11 14:08:28 +02:00
Fabien Potencier 33917e87ae removed code that supports obsolete versions of PHP 2015-09-11 13:55:03 +02:00
Fabien Potencier 4ff8b3f002 minor #1809 Fix test (nicolas-grekas)
This PR was merged into the 1.x branch.

Discussion
----------

Fix test

Commits
-------

ff9afa0 Fix test
2015-09-10 11:13:50 +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
Fabien Potencier c7e9744ca8 feature #1807 Inline original source code in compiled templates (nicolas-grekas)
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes #1807).

Discussion
----------

Inline original source code in compiled templates

For introspection purposes (e.g. instead of https://github.com/symfony/symfony/pull/15653) it is sometimes useful to be able to retrieve the original template source code.

I propose to inline it commented after the compiled class declaration.
This creates no memory nor cpu overhead while still allowing to get the source with very simple parsing logic.

Commits
-------

c9fb373 Inline original source code in compiled templates
2015-09-10 10:50:56 +02:00
Nicolas Grekas c9fb3730c2 Inline original source code in compiled templates 2015-09-10 10:50:55 +02:00
Fabien Potencier 7d21eb9984 bumped version to 1.21.3-DEV 2015-09-09 07:33:05 +02:00
Fabien Potencier ddce1136be prepared the 1.21.2 release v1.21.2 2015-09-09 07:28:51 +02:00
Fabien Potencier 18854ff234 updated CHANGELOG 2015-09-09 07:23:01 +02:00
Fabien Potencier 825bdc1afc updated CHANGELOG 2015-09-06 08:45:56 +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
Fabien Potencier b1a4c14b60 bug #1801 Fix variable names for the deprecation triggering code (stof)
This PR was merged into the 1.x branch.

Discussion
----------

Fix variable names for the deprecation triggering code

Closes https://github.com/twigphp/Twig/issues/1800

Commits
-------

dd446c0 Fix variable names for the deprecation triggering code
2015-09-01 11:38:14 +02:00
Christophe Coevoet dd446c0c65 Fix variable names for the deprecation triggering code 2015-09-01 11:30:25 +02:00
Fabien Potencier 0a19aab4a1 bug #1797 fix escaping strategy detection based on filename (Tobion)
This PR was merged into the 1.x branch.

Discussion
----------

fix escaping strategy detection based on filename

Fixes symfony/symfony#15095

It previously excluded any fileextension (not just `.twig`) which is pretty wrong.

Commits
-------

e403363 fix escaping strategy detection based on filename
2015-08-31 17:44:05 +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 5815c8344b minor #1796 OPcache support fix (iKwinto)
This PR was squashed before being merged into the 1.x branch (closes #1796).

Discussion
----------

OPcache support fix

According this recipe http://twig.sensiolabs.org/doc/recipes.html#refreshing-modified-templates-when-opcache-or-apc-is-enabled when using OPcache:

```
class Twig_Environment_APC extends Twig_Environment
{
    protected function writeCacheFile($file, $content)
    {
        parent::writeCacheFile($file, $content);

        // Compile cached file into bytecode cache
        if (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) {
            opcache_compile_file($file);
        } elseif (extension_loaded('apc') && ini_get('apc.enabled')) {
            apc_compile_file($file);
        }
    }
}
```

it takes an error:

```
Cannot redeclare class __TwigTemplate_12e7606b10ee267fa4174f660f86451aed936cc5680300a6442092f337c910cf
```

This is due to fact that the function ```opcache_compile_file($file)``` executes the file. But it should not do so in accordance with the documentation: http://php.net/manual/en/function.opcache-compile-file.php

There is a bug report: https://bugs.php.net/bug.php?id=66066 (since 2013 👎).

This patch prevents reexecution of the compiled template.

Commits
-------

2c4af24 OPcache support fix
2015-08-27 09:48:00 +02:00
Alexander Vasilyev 2c4af24b20 OPcache support fix 2015-08-27 09:47:21 +02:00
Fabien Potencier 91c9f50716 bumped version to 1.21.2-DEV 2015-08-26 11:02:09 +02:00
Fabien Potencier ca8d3aa90b prepared the 1.21.1 release v1.21.1 2015-08-26 10:58:31 +02:00
Fabien Potencier 80f7cfc45f bug #1794 fixed support for Twig_Test_* classes (regression) (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

fixed support for Twig_Test_* classes (regression)

fixes #1791

Commits
-------

9561582 fixed support for Twig_Test_* classes
2015-08-26 10:52:21 +02:00
Fabien Potencier 9561582e2f fixed support for Twig_Test_* classes 2015-08-26 10:26:15 +02:00
Fabien Potencier 71b4dc2572 bumped version to 1.21.1-DEV 2015-08-24 11:58:37 +02:00
Fabien Potencier 913d282cac prepared the 1.21.0 release v1.21.0 2015-08-24 11:51:18 +02:00
Fabien Potencier 1dfa7dfb5d minor #1789 added a note about TwigFiddle (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

added a note about TwigFiddle

Not sure where to mention it, the IDE section seems ok.

ping @ninsuo

Commits
-------

bc9911e added a note about TwigFiddle
2015-08-23 14:35:41 +02:00
Fabien Potencier bc9911e326 added a note about TwigFiddle 2015-08-23 14:22:16 +02:00
Fabien Potencier d08ceadf4a fixed wrong commit 2015-08-23 14:21:39 +02:00
Fabien Potencier d6e42d167e removed obsolete comment 2015-08-23 10:15:17 +02:00
Fabien Potencier f4e281e3dd minor #1784 optimized the filesystem loader (fabpot)
This PR was merged into the 1.x branch.

Discussion
----------

optimized the filesystem loader

* added a cache for templates that do not exist
* sped up Filesystem::exists() by avoiding the creation of exceptions

same as d2b97b49f2 that was reverted because of a BC break
and same as what is in 2.0 (but in a BC way).

Commits
-------

21b128a optimized the filesystem loader
2015-08-22 17:46:51 +02:00
Fabien Potencier 73f820e49b minor #1786 move property initialization to the declaration when possible (Tobion)
This PR was merged into the 1.x branch.

Discussion
----------

move property initialization to the declaration when possible

From #1781

Commits
-------

5951d1f move property initialization to the declaration when possible
2015-08-22 17:40:25 +02:00
Tobias Schultze 5951d1fb22 move property initialization to the declaration when possible 2015-08-22 16:48:43 +02:00
Fabien Potencier 21b128a89c optimized the filesystem loader
* added a cache for templates that do not exist
* sped up Filesystem::exists() by avoiding the creation of exceptions

same as d2b97b49f2 that was reverted because of a BC break
and same as what is in 2.0 (but in a BC way).
2015-08-22 14:43:11 +02:00
Fabien Potencier d65a1374a9 bug #1780 fix escaping strategy that is an array but not a callable (Tobion)
This PR was squashed before being merged into the 1.x branch (closes #1780).

Discussion
----------

fix escaping strategy that is an array but not a callable

https://github.com/twigphp/Twig/pull/1779#discussion-diff-37534003

Commits
-------

7f1ee9f fix escaping strategy that is an array but not a callable
2015-08-22 09:28:42 +02:00
Tobias Schultze 7f1ee9f9cb fix escaping strategy that is an array but not a callable 2015-08-22 09:28:40 +02:00
Fabien Potencier b71ce99039 minor #1778 Add missing deprecation triggers (stof)
This PR was merged into the 1.x branch.

Discussion
----------

Add missing deprecation triggers

Assetic is extending the ``Twig_Function`` class directly currently, and this was not triggering any deprecation warning

Commits
-------

cb98576 Add missing deprecation triggers
2015-08-22 09:26:11 +02:00
Fabien Potencier 5ed99139ee minor #1783 enhance travis setup (Tobion)
This PR was merged into the 1.x branch.

Discussion
----------

enhance travis setup

- require php 7 to pass
- allow failures for php7 + twig extension
- use container-based infrastructure
- <del>composer self-update to get rid of the outdated warning</del>
- add travis cache for composer
- use travis fast finish

Commits
-------

11baf55 use travis cache for composer and fast finish
7b579df fix php 5.2 compatibility
118598e enhance travis setup
2015-08-22 09:25:21 +02:00
Tobias Schultze 11baf557fd use travis cache for composer and fast finish 2015-08-21 16:47:01 +02:00
Tobias Schultze 7b579df77d fix php 5.2 compatibility 2015-08-21 16:16:21 +02:00
Tobias Schultze 118598eaf3 enhance travis setup
- require php 7 pass (except with extension)
- use container-based infrastructure
- composer self-update to get rid of the outdated warning
- install --prefer-source because travis auth fails against dist
2015-08-21 16:08:16 +02:00
Christophe Coevoet cb98576934 Add missing deprecation triggers 2015-08-20 11:31:45 +02:00
Fabien Potencier 92fa52b874 bug #1775 Fix the deprecation warning for functions and tests (stof)
This PR was merged into the 1.x branch.

Discussion
----------

Fix the deprecation warning for functions and tests

Otherwise, when a function does not define any filter, the message looks like that:

```
Using an instance of "Twig_Environment" for function "nelmio_js_logger" is deprecated. Use Twig_SimpleFunction instead.
```

This happens because the notice about the undefined variable gets silenced too, and ``get_class(null)`` returns the current class.

Commits
-------

1687097 Fix the deprecation warning for functions and tests
2015-08-19 23:10:59 +02:00
Christophe Coevoet 1687097ed0 Fix the deprecation warning for functions and tests 2015-08-19 15:19:42 +02:00
Fabien Potencier d4aa0238c3 bumped version to 1.21 2015-08-18 15:28:19 +02:00
Fabien Potencier 4cb0704e07 avoid a PHPUnit message when no legacy tests are in the test suite 2015-08-18 15:15:46 +02:00