Fabien Potencier
2fa8bce914
Move Drupal test file to tests/
2021-05-18 13:09:01 +02:00
Fabien Potencier
124f10c27e
Revert "bug #3499 Fix: A template name cannot be an absolute path (mvorisek)"
...
This reverts commit 83f26e402b , reversing
changes made to f5d3c704df .
2021-05-16 14:06:26 +02:00
Fabien Potencier
59f3e8e5dc
Fix CS
2021-05-12 09:19:37 +02:00
Michael Voříšek
3a67fc7dc5
Fix: A template name cannot be an absolute path
2021-04-07 17:57:24 +02:00
Harry Bournis
53a3ccd2d2
Fix odd not working for negative numbers
2020-11-05 11:55:45 +01:00
Fabien Potencier
df9c9f2165
Fix "include(template_from_string())"
2020-10-27 13:39:31 +01:00
Fabien Potencier
b1c9faa33e
Fix PHP 8 support
2020-10-21 14:08:16 +02:00
Fabien Potencier
d46aeb0724
Fix PHP 8 support
2020-10-21 13:43:26 +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
80a4a1f31e
Remove tests that do not make sense
2020-08-23 14:46:38 +02:00
Andreas
1ee72d9e15
Make round brackets optional for one argument tests like sameas
2020-08-23 14:16:31 +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
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
94aa9bf305
Add a test
2020-08-05 16:53:34 +02:00
Bozhidar Hristov
04658c9f59
Fixes #3351
2020-07-09 14:43:36 +02:00
Fabien Potencier
841906b110
Fix a regression when not using a space before an operator
2020-07-06 14:40:02 +02:00
Jannik Zschiesche
ccc2dbb043
Allow trailing commas in macros + functions + filters
2020-07-06 13:58:05 +02:00
Jérémy Derussé
d8259519c0
Restrict callables to closures in filters
2020-07-05 15:30:15 +02:00
Nicolas Grekas
5dc364469b
Minor fixes
2020-05-21 11:01:36 +02:00
Fabien Potencier
6a0ab744d2
Fix PHP 8 compat
2020-05-19 14:22:31 +02:00
Fabien Potencier
5663351a49
Fix ambiguous syntax parsing
2020-02-23 09:40:57 +01:00
Fabien Potencier
5724cbeddf
Fix ambiguous syntax parsing
2020-02-21 08:31:42 +01:00
Fabien Potencier
6092135057
Add support for exponential numbers
2019-10-22 17:32:36 +02:00
Fabien Potencier
7a99a4e7e5
Optimize block('foo') ?? 'bar'
2019-09-20 12:40:56 +02:00
Fabien Potencier
5861a539e4
removed usage of getmockBuilder() when not needed
2019-08-08 11:59:51 +02:00
Jérémy Derussé
b776e41f5a
Update to PhpUnitBridge and fix deprecations
2019-08-08 09:39:49 +02:00
Jérémy Derussé
074e46ae33
Upgrade minimal version of php
2019-08-08 00:31:49 +02:00
Fabien Potencier
b202fe3809
fixed the "empty" test on Traversable instances
2019-08-07 17:02:01 +02:00
Fabien Potencier
0947777bc6
fixed tests for PHP 7.4
2019-06-30 15:21:28 +02:00
Fabien Potencier
22a1317249
moved tests under tests/
2019-06-30 14:48:27 +02:00