Commit Graph

2741 Commits

Author SHA1 Message Date
Fabien Potencier c3d92b2cc7 Merge branch '1.x'
* 1.x:
  updated CHANGELOG
  Fix variable names for the deprecation triggering code
  Mark test skipped if cannot write to cache directory.
2015-09-06 08:47:52 +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 90c9bc31d2 readded code lost in master 2015-09-01 07:59:31 +02:00
Fabien Potencier 3abc195e5f Merge branch '1.x'
* 1.x:
  fix escaping strategy detection based on filename
  OPcache support fix
2015-09-01 07:51:16 +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 9bea367f3d Merge branch '1.x'
* 1.x:
  bumped version to 1.21.2-DEV
  prepared the 1.21.1 release
  fixed support for Twig_Test_* classes
  bumped version to 1.21.1-DEV
  prepared the 1.21.0 release
2015-08-26 11:09:06 +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 962119e8dd Merge branch '1.x'
* 1.x:
  added a note about TwigFiddle
  fixed wrong commit
  removed obsolete comment
2015-08-23 14:35:59 +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 5fc0ffc87b fixed built-in loaders to implement Twig_ExistsLoaderInterface 2015-08-23 10:10:04 +02:00
Fabien Potencier cb66631b30 feature #1773 moved more methods/properties to private (fabpot)
This PR was merged into the 2.0-dev branch.

Discussion
----------

moved more methods/properties to private

I'd like to make even more properties/methods private in 2.0. We can always put them back to protected if that makes sense.

Commits
-------

905a2a8 moved more methods/properties to private
2015-08-23 10:09:03 +02:00
Fabien Potencier 905a2a8102 moved more methods/properties to private 2015-08-23 09:05:30 +02:00
Fabien Potencier a50f8ed85a Merge branch '1.x'
* 1.x:
  move property initialization to the declaration when possible
  optimized the filesystem loader
2015-08-22 17:50:35 +02:00
Fabien Potencier 34666ee7c2 bug #1785 Faster filesystem loader master (fabpot)
This PR was merged into the 2.0-dev branch.

Discussion
----------

Faster filesystem loader master

We need to keep calling `findTemplate()` for all methods to keep BC.

Commits
-------

3da99ce removed BC break in filesystem loader
638eedb Revert "removed an unneeded protected method"
2015-08-22 17:48:43 +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 3a62bb3f49 minor #1779 Callable typehint (Tobion)
This PR was merged into the 2.0-dev branch.

Discussion
----------

Callable typehint

Add callable typehint which are available since php 5.4 so are safe to use in twig 2.0.

Commits
-------

465208d add callable typehints
2015-08-22 17:42:50 +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
Fabien Potencier c35cc3413a minor #1787 remove unused private property (Tobion)
This PR was merged into the 2.0-dev branch.

Discussion
----------

remove unused private property

Commits
-------

f24a4ae remove unused private property
2015-08-22 17:39:36 +02:00
Tobias Schultze f24a4aeb15 remove unused private property 2015-08-22 16:51:58 +02:00
Tobias Schultze 5951d1fb22 move property initialization to the declaration when possible 2015-08-22 16:48:43 +02:00
Fabien Potencier 3da99ce98b removed BC break in filesystem loader 2015-08-22 14:54:35 +02:00
Fabien Potencier 638eedb622 Revert "removed an unneeded protected method"
This reverts commit 7de9a57b92.
2015-08-22 14:45:46 +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 98b1f31f50 Merge branch '1.x'
* 1.x:
  fix escaping strategy that is an array but not a callable
  use travis cache for composer and fast finish
  fix php 5.2 compatibility
  enhance travis setup
  Add missing deprecation triggers
  Fix the deprecation warning for functions and tests
  bumped version to 1.21
  avoid a PHPUnit message when no legacy tests are in the test suite
2015-08-22 09:33:59 +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
Tobias Schultze 465208dcfa add callable typehints
make callable nullable to support custom compilation without a callable

remove non-existent callables from tests

add phpdoc for filter/tests/functions
2015-08-21 13:42:59 +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