Commit Graph

3783 Commits

Author SHA1 Message Date
Fabien Potencier 39deb6fe54 feature #2635 Optimize the performance of the dot operator (fabpot)
This PR was squashed before being merged into the 2.x branch (closes #2635).

Discussion
----------

Optimize the performance of the dot operator

This is an alternative to #2359 and #2361, and closes #2326.

Basically, we don't need to call `hasExtension()` at runtime for the sandbox check when calling the dot operator as we know if it's enabled at compile time (the cache hash depends on enables extensions).

My benchmarks shows a *huge* performance improvement (**around 20%**) by doing so (especially when not using the sandbox, which is almost always the case).

Commits
-------

c917d352 fixed resetting options hash when overriding all extensions
89876d23 optimized the . operator performance
2018-03-02 07:58:59 -08:00
Fabien Potencier c917d35245 fixed resetting options hash when overriding all extensions 2018-03-02 07:46:13 -08:00
Fabien Potencier 89876d23e8 optimized the . operator performance 2018-03-02 07:44:33 -08:00
Fabien Potencier 00e925d49c Merge branch '1.x' into 2.x
* 1.x:
  Update .travis.yml
  Fix possible array to string conversion concealing actual error
  Make variable names deterministic
  Be able to count on iterator
  made it clear that placeholders are free-forms for the replace filter
  contents -> content
2018-03-01 16:12:51 -08:00
Fabien Potencier e8555dc8ee minor #2633 Update .travis.yml to test on PHP 7.2 (gmponos)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2633).

Discussion
----------

Update .travis.yml to test on PHP 7.2

Commits
-------

8e7527ec Update .travis.yml
2018-02-28 08:23:15 -08:00
Mponos George 8e7527ec97 Update .travis.yml 2018-02-28 08:23:05 -08:00
Fabien Potencier 8a7fba9560 bug #2624 Fix possible array to string conversion concealing actual error (finwe)
This PR was merged into the 1.x branch.

Discussion
----------

Fix possible array to string conversion concealing actual error

This is a 1.x branch backport of #2613

Commits
-------

7ba3b5a5 Fix possible array to string conversion concealing actual error
2018-02-07 20:24:52 +01:00
Fabien Potencier f2e5f4080c bug #2621 Make variable names deterministic (lstrojny)
This PR was merged into the 1.x branch.

Discussion
----------

Make variable names deterministic

Variables should be deterministic to support reproducible builds as outlined in https://github.com/symfony/symfony/issues/25958

Commits
-------

6ab5fe9b Make variable names deterministic
2018-02-07 20:22:14 +01:00
Matěj Humpál 7ba3b5a589 Fix possible array to string conversion concealing actual error 2018-02-07 15:47:38 +01:00
Lars Strojny 6ab5fe9b8f Make variable names deterministic 2018-01-31 18:04:41 +01:00
Fabien Potencier e923101942 bug #2600 Be able to count on iterator (scuben)
This PR was merged into the 1.x branch.

Discussion
----------

Be able to count on iterator

This PR allows to count on `\Traversable` Objects. Not sure if I made the change to the correct branch. Tell me please if I should target 2.x or master.

Commits
-------

be2c32cc Be able to count on iterator
2018-01-30 17:11:48 +01:00
ARTACK WebLab be2c32cc1c Be able to count on iterator 2018-01-30 17:04:01 +01:00
Fabien Potencier 45990c3644 minor #2620 Remove old class (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Remove old class

This class does not exist in Twig 2.x.

Commits
-------

398d826d removed old class
2018-01-30 14:51:48 +01:00
Fabien Potencier 92ebfcb1cc minor #2618 Optimized compilation for arrays when using a['b'] notation (fabpot)
This PR was squashed before being merged into the 2.x branch (closes #2618).

Discussion
----------

Optimized compilation for arrays when using a['b'] notation

Under certain conditions, and thanks to the `??` operator, it's possible to optimize array calls (and avoid the call to `twig_get_attribute()`).

On my local machine, code is almost twice as fast, which is nice if you are using a lot of `a["b"]` calls of nested ones.

refs #2547

Commits
-------

6f7ea45c optimized nested array calls
f3b8f4a8 added some tests
d501e0e5 optimized compilation for arrays when using a['b'] notation under certain conditions
2018-01-30 14:51:06 +01:00
Fabien Potencier 6f7ea45c03 optimized nested array calls 2018-01-30 14:13:54 +01:00
Fabien Potencier 398d826d20 removed old class 2018-01-30 14:02:48 +01:00
Fabien Potencier f3b8f4a8d4 added some tests 2018-01-30 12:38:28 +01:00
Fabien Potencier d501e0e5bd optimized compilation for arrays when using a['b'] notation under certain conditions 2018-01-30 12:12:45 +01:00
Fabien Potencier 734d2d886f minor #2617 Performance optimization (fabpot)
This PR was merged into the 2.x branch.

Discussion
----------

Performance optimization

This PR avoids calling `$this->getSourceContext()` whenever we call `twig_get_attribute()`. That saves one method call and one object creation.

Commits
-------

89cbb5c4 optimized twig_get_attribute (avoid calling getSourceContext())
2018-01-30 12:10:36 +01:00
Fabien Potencier 89cbb5c4c9 optimized twig_get_attribute (avoid calling getSourceContext()) 2018-01-30 11:27:24 +01:00
Fabien Potencier f93530b440 made it clear that placeholders are free-forms for the replace filter 2018-01-30 08:01:42 +01:00
Fabien Potencier 1040696c52 minor #2612 English tweak contents -> content (weaverryan)
This PR was merged into the 1.x branch.

Discussion
----------

English tweak contents -> content

The most minor PR ever :).

Made to the 1.x branch, also applies to 2.x obviously.

Commits
-------

19e3fb8c contents -> content
2018-01-30 07:52:44 +01:00
Fabien Potencier d4482c9ab9 Merge branch '1.x' into 2.x
* 1.x:
  Update license year
  Update advanced.rst
2018-01-07 18:54:41 +01:00
Fabien Potencier 75baf9f897 minor #2611 Update license year (m1guelpf)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2611).

Discussion
----------

Update license year

TO DO:

- [x] Wait to the next year (100% done, depends on timezone)
- [ ] Merge!

:octocat:

Commits
-------

012ca796 Update license year
2018-01-07 18:54:25 +01:00
Miguel Piedrafita 012ca796bf Update license year 2018-01-07 18:54:25 +01:00
Ryan Weaver 19e3fb8c1a contents -> content 2018-01-03 15:09:52 -05:00
Fabien Potencier b36e3eb452 minor #2598 Update advanced.rst (pfwd)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2598).

Discussion
----------

Update advanced.rst

I noticed that the rot13Provider wasn't called correctly as it was trying to access a local variable instead of calling $this

Commits
-------

b42fd643 Update advanced.rst
2017-12-07 07:56:46 -08:00
Peter Fisher b42fd6435e Update advanced.rst
I noticed that the rot13Provider wasn't called correctly as it was trying to access a local variable instead of calling $this
2017-12-07 07:56:46 -08:00
Fabien Potencier 0b9a64d842 updated CHANGELOG 2017-11-12 10:48:08 -08:00
Fabien Potencier 6dc9d9e7d9 Merge branch '1.x' into 2.x
* 1.x:
  updated CHANGELOG
2017-11-12 10:47:55 -08:00
Fabien Potencier 5322c9b4ca updated CHANGELOG 2017-11-12 10:47:15 -08:00
Fabien Potencier 6019605609 Merge branch '1.x' into 2.x
* 1.x:
  Environment::resolveTemplate now accepts instances of TemplateWrapper
  Change typo in documentation
  fix grammar
2017-11-12 10:45:51 -08:00
Fabien Potencier 9c2b1dc528 bug #2586 Environment::resolveTemplate now accepts instances of TemplateWrapper (victorwelling)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2586).

Discussion
----------

Environment::resolveTemplate now accepts instances of TemplateWrapper

The [documentation on the include function](https://twig.symfony.com/doc/2.x/functions/include.html) states (on the template expression):
> And if the expression evaluates to a Twig_Template or a Twig_TemplateWrapper instance, Twig will use it directly […]

This is currently broken, as `twig_include` [relies on `resolveTemplate`](https://github.com/twigphp/Twig/blob/31b577863b5ae8d19e2cefd174e95a433f16491f/lib/Twig/Extension/Core.php#L1304), which doesn't handle instances of `TemplateWrapper`. This PR fixes that.

For the sake of completeness: the `include` tag doesn't have this problem, as it relies on the `loadTemplate` method of the `Template` class which _does_ handle this case.

Commits
-------

78a4f2fb Environment::resolveTemplate now accepts instances of TemplateWrapper
2017-11-12 10:30:56 -08:00
Victor Welling 78a4f2fb59 Environment::resolveTemplate now accepts instances of TemplateWrapper 2017-11-12 10:30:50 -08:00
Fabien Potencier acfa0311e7 minor #2562 Change typo in documentation (uthopiko)
This PR was submitted for the master branch but it was merged into the 1.x branch instead (closes #2562).

Discussion
----------

Change typo in documentation

In example of use for test_iterable function there is a typo

Commits
-------

8607f13d Change typo in documentation
2017-11-12 10:27:33 -08:00
Asier Ramos 8607f13db7 Change typo in documentation
In example of use for test_iterable function there is a typo
2017-11-12 10:27:33 -08:00
Fabien Potencier 7014fda0af minor #2570 fix grammar (redbrickone)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2570).

Discussion
----------

fix grammar

Commits
-------

d4309898 fix grammar
2017-11-12 10:24:46 -08:00
Chris Wright d430989818 fix grammar 2017-11-12 10:24:45 -08:00
Fabien Potencier 31b577863b Merge branch '1.x' into 2.x
* 1.x:
  Fix PHP 5.3 build
  bumped version to 1.35.1-DEV
  prepared the 1.35.0 release
2017-11-07 13:51:24 -08:00
Fabien Potencier 2610f2e128 minor #2582 Fix PHP 5.3 Travis build (c960657)
This PR was merged into the 1.x branch.

Discussion
----------

Fix PHP 5.3 Travis build

PHP 5.3 is only supported on Debian Precise.

Commits
-------

3a45bd48 Fix PHP 5.3 build
2017-11-07 13:50:11 -08:00
Christian Schmidt 3a45bd48cf Fix PHP 5.3 build 2017-11-07 22:28:59 +01:00
Fabien Potencier d8d888e2ae bumped version to 2.4.5-DEV 2017-09-27 11:11:00 -07:00
Fabien Potencier eddb97148a prepared the 2.4.4 release v2.4.4 2017-09-27 11:10:31 -07:00
Fabien Potencier a2ce3865a0 updated CHANGELOG 2017-09-27 11:09:40 -07:00
Fabien Potencier e7944a1f67 bumped version to 1.35.1-DEV 2017-09-27 11:07:18 -07:00
Fabien Potencier daa657073e prepared the 1.35.0 release v1.35.0 2017-09-27 11:06:46 -07:00
Fabien Potencier f26bc88dbc Merge branch '1.x' into 2.x
* 1.x:
  add throws tags doc block for Twig_Environment:load
2017-09-27 11:03:02 -07:00
Fabien Potencier 8a47e05b73 minor #2557 add throws tags doc block for Twig_Environment:load (Haehnchen)
This PR was submitted for the 2.x branch but it was merged into the 1.x branch instead (closes #2557).

Discussion
----------

add throws tags doc block for Twig_Environment:load

On an internal project review we noticed that `\Twig_Environment::load` is not providing throw tags. As this method is just a proxy for `\Twig_Environment::loadTemplate` which itself is _internal_ we had some discussion around.

this PR provides same throw tags as _loadTemplate_. Maybe this helps to understand code usage

Commits
-------

882c7aab add throws tags doc block for Twig_Environment:load
2017-09-27 10:58:47 -07:00
Daniel Espendiller 882c7aab2a add throws tags doc block for Twig_Environment:load 2017-09-27 10:58:47 -07:00
Fabien Potencier 7588a040f3 updated CHANGELOG 2017-09-27 10:50:40 -07:00