Commit Graph

109 Commits

Author SHA1 Message Date
Fabien Potencier 1327db55e9 Merge branch '2.x' into 3.x
* 2.x:
  Update format_time.rst
  Fix "include(template_from_string())"
  Fix PHPUnit config
2020-10-27 15:15:09 +01:00
Fabien Potencier 497f027cd4 Merge branch '1.x' into 2.x
* 1.x:
  Fix "include(template_from_string())"
  Fix PHPUnit config
2020-10-27 15:14:55 +01:00
Fabien Potencier df9c9f2165 Fix "include(template_from_string())" 2020-10-27 13:39:31 +01:00
Fabien Potencier df7471fed6 Merge branch '2.x' into 3.x
* 2.x:
  Fix PHP 8 support
2020-10-21 14:27:08 +02:00
Fabien Potencier 53650c55c1 Merge branch '1.x' into 2.x
* 1.x:
  Fix PHP 8 support
2020-10-21 14:27:01 +02:00
Fabien Potencier b1c9faa33e Fix PHP 8 support 2020-10-21 14:08:16 +02:00
Fabien Potencier 3c56677c85 Merge branch '2.x' into 3.x
* 2.x:
  Fix PHP 8 support
2020-10-21 13:43:41 +02:00
Fabien Potencier 2ffab581fe Merge branch '1.x' into 2.x
* 1.x:
  Fix PHP 8 support
2020-10-21 13:43:35 +02:00
Fabien Potencier d46aeb0724 Fix PHP 8 support 2020-10-21 13:43:26 +02:00
Fabien Potencier 1fb577363d Merge branch '2.x' into 3.x
* 2.x:
  Fix sandbox support when using include(template_from_string())
  Add test to verify that filter is not working when template_from_string is used.
  In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
2020-08-23 17:55:24 +02:00
Fabien Potencier ab6695b580 Merge branch '1.x' into 2.x
* 1.x:
  Fix sandbox support when using include(template_from_string())
  Add test to verify that filter is not working when template_from_string is used.
  In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
2020-08-23 17:55:14 +02:00
Fabien Potencier c7be1bb3c4 Fix sandbox support when using include(template_from_string()) 2020-08-23 17:48:34 +02:00
Bozhidar Hristov 04431228af Add test to verify that filter is not working when template_from_string is used. 2020-08-23 17:46:12 +02:00
Fabien Potencier 54eff0d96e bug #3341 In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError (thijzert)
This PR was squashed before being merged into the 1.x branch.

Discussion
----------

In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError

If a template accidentally performs `|filter(...)` on a variable that isn't traversable (e.g. `null`), the calling code will encouter the raw `TypeError` that results from Twig trying to construct an `IteratorIterator` on that variable. This means that context information (e.g., in which exact template the error occurred, and on which line) is discarded, which makes it very difficult to debug your templates.

This commit adds code to throw a `RuntimeError` if Twig encounters a situation where there's no valid way to filter an array.

Commits
-------

567b1e2a In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
2020-08-23 16:40:19 +02:00
Thijs van Dijk 567b1e2a06 In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError 2020-08-23 16:40:13 +02:00
Fabien Potencier 03491db322 Merge branch '1.x' into 2.x
* 1.x:
  Remove tests that do not make sense
2020-08-23 14:46:45 +02:00
Fabien Potencier 80a4a1f31e Remove tests that do not make sense 2020-08-23 14:46:38 +02:00
Fabien Potencier 7759111e75 Merge branch '2.x' into 3.x
* 2.x:
  Update CHANGELOG
  Update CHANGELOG
  Fix previous merge
  Make round brackets optional for one argument tests like sameas
2020-08-23 14:22:39 +02:00
Fabien Potencier 9bf49d5ccf Merge branch '1.x' into 2.x
* 1.x:
  Update CHANGELOG
  Fix previous merge
  Make round brackets optional for one argument tests like sameas
2020-08-23 14:22:09 +02:00
Andreas 1ee72d9e15 Make round brackets optional for one argument tests like sameas 2020-08-23 14:16:31 +02:00
Fabien Potencier f9ae0f8237 Merge branch '2.x' into 3.x
* 2.x:
  Bump version
  Bump version
  Tweak docs
  Update CHANGELOG
  Support object init from variable
2020-08-23 14:02:58 +02:00
Fabien Potencier 77dcff7186 Merge branch '1.x' into 2.x
* 1.x:
  Bump version
  Tweak docs
  Update CHANGELOG
  Support object init from variable
2020-08-23 14:01:18 +02:00
Fabien Potencier b0ce4f64ba Update CHANGELOG 2020-08-23 13:56:44 +02:00
Jérôme TAMARELLE 133edb3696 Support object init from variable
{a} is a shortcut for {a:a}
From ECMAScript 2015 syntax https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Object_initializer
2020-08-23 13:54:49 +02:00
Fabien Potencier 222d053733 Merge branch '2.x' into 3.x
* 2.x:
  Fix CS
  Fix CS
2020-08-23 13:49:50 +02:00
Fabien Potencier 81612a5c7d Merge branch '1.x' into 2.x
* 1.x:
  Fix CS
2020-08-23 13:49:18 +02:00
Fabien Potencier bde54e11b8 Fix CS 2020-08-23 13:48:32 +02:00
Fabien Potencier f787c032ab Migrate more tests 2020-08-23 12:47:51 +02:00
Fabien Potencier e5882d9fb4 Update phpunit assertion 2020-08-23 12:22:59 +02:00
Fabien Potencier 0fdf96c389 Merge branch '2.x' into 3.x
* 2.x:
  Add a test
  Fix typo
  Fix compatibility with PHPUnit 10
  Update doc for macro with embed tags
  fix typo in ApplyTokenParser PHP doc
  Fixes #3351
2020-08-05 16:54:08 +02:00
Fabien Potencier 38bd74d03a Merge branch '1.x' into 2.x
* 1.x:
  Add a test
  fix typo in ApplyTokenParser PHP doc
  Fixes #3351
2020-08-05 16:53:59 +02:00
Fabien Potencier 94aa9bf305 Add a test 2020-08-05 16:53:34 +02:00
Jérôme TAMARELLE 9a83f7edf6 Fix compatibility with PHPUnit 10 2020-07-29 03:03:03 +02:00
Bozhidar Hristov 04658c9f59 Fixes #3351 2020-07-09 14:43:36 +02:00
Fabien Potencier 57ca24c5f3 Merge branch '2.x' into 3.x
* 2.x:
  Fix a regression when not using a space before an operator
2020-07-06 15:35:21 +02:00
Fabien Potencier e063bab1a6 Merge branch '1.x' into 2.x
* 1.x:
  Fix a regression when not using a space before an operator
2020-07-06 15:35:12 +02:00
Fabien Potencier 841906b110 Fix a regression when not using a space before an operator 2020-07-06 14:40:02 +02:00
Fabien Potencier 8a6c47cbf2 Merge branch '2.x' into 3.x
* 2.x:
  Allow trailing commas in macros + functions + filters
2020-07-06 14:00:03 +02:00
Fabien Potencier 865da858ae Merge branch '1.x' into 2.x
* 1.x:
  Allow trailing commas in macros + functions + filters
2020-07-06 13:59:53 +02:00
Jannik Zschiesche ccc2dbb043 Allow trailing commas in macros + functions + filters 2020-07-06 13:58:05 +02:00
Fabien Potencier 81e0746b95 Merge branch '2.x' into 3.x
* 2.x:
  Restrict callables to closures in filters
  Fix CS
  Update html_to_markdown.rst
2020-07-05 15:32:53 +02:00
Fabien Potencier d190c2e7f7 Merge branch '1.x' into 2.x
* 1.x:
  Restrict callables to closures in filters
2020-07-05 15:32:43 +02:00
Jérémy Derussé d8259519c0 Restrict callables to closures in filters 2020-07-05 15:30:15 +02:00
Fabien Potencier bc91b0e14c bug #3353 [3.x] Fix twig_compare w.r.t. whitespace trimming (guilliamxavier)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

[3.x] Fix twig_compare w.r.t. whitespace trimming

Fixes #3352

Commits
-------

9d115f68 [3.x] Fix twig_compare w.r.t. whitespace trimming
2020-07-05 15:21:59 +02:00
Guilliam Xavier 9d115f6831 [3.x] Fix twig_compare w.r.t. whitespace trimming 2020-07-05 15:21:52 +02:00
Fabien Potencier c83ede7fcd Merge branch '2.x' into 3.x
* 2.x:
  Fix CS
  Fix CS
2020-06-22 08:17:05 +02:00
Fabien Potencier c38f96318b Fix CS 2020-06-22 08:15:56 +02:00
Fabien Potencier 83d6a120ff bug #3256 Fix twig_compare float-string trailing whitespace + refactor (guilliamxavier)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix twig_compare float-string trailing whitespace + refactor

Fixes #3345

Refs #2966 (and #3186)

(feel free to discard the "Factorize" commit if you favor performance over maintainability)

Commits
-------

d6822aeb Fix twig_compare float-string trailing whitespace + refactor
2020-06-08 12:43:20 +02:00
Guilliam Xavier d6822aebcf Fix twig_compare float-string trailing whitespace + refactor 2020-06-08 12:43:14 +02:00
Christophe Coevoet bf24f136b9 Fix the compilation of Twig comparison operators
The new compilation implemented in Twig 3 for PHP 7 (to match the
comparison semantic of PHP 8) was missing the surrounding braces (which
are part of the AsbtractBinary compilation). This caused issues when the
full expression would involve other operators (like the not operator),
as things would then rely on having the correct precedence in PHP (which
would not be the case).
2020-06-05 15:54:17 +02:00