Fabien Potencier
a93723eae2
Fix bug
2024-01-25 13:09:58 +01:00
Fabien Potencier
0d3a283907
Tweak code
2024-01-25 13:09:58 +01:00
Fabien Potencier
71e90fab7b
Remove some tests
2024-01-25 13:09:58 +01:00
Fabien Potencier
4fd62abb87
-
2024-01-25 13:09:58 +01:00
Fabien Potencier
a9c7307b5c
Tweak code
2024-01-25 13:09:58 +01:00
Fabien Potencier
15879406c8
Remove the new yield nodes
2024-01-25 13:09:58 +01:00
Fabien Potencier
3b6cbf98d8
Remove usage of ob_* functions in favor of yielding
2024-01-25 13:09:52 +01:00
Fabien Potencier
d21666f728
Throws proper Twig exception when using cycle on an empty array
2024-01-11 21:47:04 +01:00
Fabien Potencier
433189bb5a
feature #3959 Optimize TextNodes (fabpot)
...
This PR was merged into the 3.x branch.
Discussion
----------
Optimize TextNodes
Not a great perf optimization, but it makes the node graph simpler which helps when we need to debug templates.
Commits
-------
c44bd1ff Optimize TextNodes
2024-01-11 14:01:35 +01:00
Fabien Potencier
cccf8b7e20
minor #3960 Add tests when a template doesn't have output nodes (fabpot)
...
This PR was merged into the 3.x branch.
Discussion
----------
Add tests when a template doesn't have output nodes
refs #3950 cc `@smnandre`
Commits
-------
d53509d4 Add tests when a template doesn't have output nodes
2024-01-11 08:39:22 +01:00
Fabien Potencier
d53509d457
Add tests when a template doesn't have output nodes
2024-01-11 08:19:14 +01:00
Fabien Potencier
c44bd1ff62
Optimize TextNodes
2024-01-10 20:22:00 +01:00
Fabien Potencier
9c0897fa2c
Remove usage of list() in favor of []
2024-01-05 09:48:24 +01:00
Christian Flothmann
665dce899f
rework the CaptureNode implementation
2024-01-01 15:43:59 +01:00
Fabien Potencier
6ebbc30593
Abstract node capture in its own Node
2023-12-30 10:14:36 +01:00
Fabien Potencier
6e2f2655a8
Add missing dots at the end of exception messages
2023-12-24 09:54:44 +01:00
Fabien Potencier
0b9e30e3d2
Simplify code
2023-12-20 20:43:49 +01:00
Fabien Potencier
e6a98a000f
Fix test without any assertions
2023-12-20 20:34:04 +01:00
Fabien Potencier
fca89954f1
Simplify tests
2023-12-20 20:34:04 +01:00
Fabien Potencier
204cd6f412
Merge branch '2.x' into 3.x
...
* 2.x:
Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source
2023-12-19 08:19:15 +01:00
Yaakov Saxon
a18da1614a
Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source
2023-12-19 08:18:35 +01:00
Fabien Potencier
54d34b969b
Move functions for CoreExtension
2023-12-10 20:13:10 +01:00
Fabien Potencier
72071e8ece
Move functions for EscaperExtension
2023-12-10 11:49:57 +01:00
Fabien Potencier
196e91dd72
Move functions for StringLoaderExtension
2023-12-10 11:38:36 +01:00
Fabien Potencier
d4d016034c
Move functions for DebugExtension
2023-12-10 11:35:00 +01:00
Fabien Potencier
2f73ee35ca
minor #3900 Minor rename of Sandbox test: functions->methods (YSaxon)
...
This PR was merged into the 3.x branch.
Discussion
----------
Minor rename of Sandbox test: functions->methods
Commits
-------
62732646 Minor rename of SandboxTest functions->methods
2023-11-21 17:18:42 +01:00
Fabien Potencier
4be326aeeb
Fix tests and CS
2023-11-21 14:57:52 +01:00
Yaakov Saxon
62732646c8
Minor rename of SandboxTest functions->methods
2023-10-27 12:15:56 -04:00
Fabien Potencier
b285fccd59
bug #3830 Catch errors thrown during template rendering (richards-square)
...
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Catch errors thrown during template rendering
Some errors, like not providing a function the proper number of arguments or division by zero, extend from `\Error` rather than `\Exception`. This PR catches these types of errors during template rendering and throws a `RuntimeError` in order to provide better debugging information.
Commits
-------
85bf01b4 Catch errors thrown during template rendering
2023-10-26 17:55:51 -07:00
Drew Richards
85bf01b4ab
Catch errors thrown during template rendering
2023-10-26 17:55:48 -07:00
Fabien Potencier
248855b34b
Merge branch '2.x' into 3.x
...
* 2.x:
Fix premature loop exit in Security Policy lookup of allowed methods/properties
2023-10-26 17:38:13 -07:00
Yaakov Saxon
5e1838dbca
Fix premature loop exit in Security Policy lookup of allowed methods/properties
2023-10-26 17:37:13 -07:00
Fabien Potencier
5193653ecb
Fix CS
2023-10-08 09:05:22 +02:00
Fabien Potencier
974c866961
Remove Drupal tests
2023-09-11 17:40:51 +02:00
Fabien Potencier
5f7c48ca7d
Fix tests
2023-09-11 17:36:13 +02:00
Fabien Potencier
da38e858e3
Update Drupal version in tests
2023-07-28 12:21:15 +02:00
Nicolas Grekas
75efa5e1ba
Fix spread operator implementation
2023-07-20 18:11:45 +02:00
Ryan Weaver
ba4fe3ba34
Adding support for the ...spread operator on arrays and hashes
2023-07-20 16:08:57 +02:00
Jacob Richardson
f136668933
Restores the leniency of the matches twig comparison, allowing null subject to result in a non-match.
...
Resolves BC break introduced in PR https://github.com/twigphp/Twig/pull/3687
As per pattern in https://github.com/twigphp/Twig/pull/3617
2023-02-07 17:07:16 +00:00
ju1ius
4f2f3f814e
pass the current key to reduce filter's callback
2023-01-25 10:42:37 +01:00
Fabien Potencier
a82e94d911
Add some tests
2022-12-27 12:31:54 +01:00
Fabien Potencier
f6ef36a447
Merge branch '2.x' into 3.x
...
* 2.x:
do not clean up whitespace text nodes inside if tags
2022-12-26 20:36:12 +01:00
Christian Flothmann
c8ec092ceb
do not clean up whitespace text nodes inside if tags
2022-12-26 18:04:52 +01:00
Fabien Potencier
d769ae90d1
feature #3670 Add "some" and "every" filters (Jean-Beru)
...
This PR was merged into the 3.x branch.
Discussion
----------
Add "some" and "every" filters
This PR adds 2 new tests inspired from Javascript's functions: [some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some ) and [every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every ).
Usage :
```twig
Value {{ ([1, 2, 3] has some v => v == 2) ? 'found' : 'not found' }}
Key {{ ([1, 2, 3] has some (v, k) => k == 2) ? 'found' : 'not found' }}
Every values {{ ([1, 2, 3] has every v => 42 > v) ? 'match' : 'do not match' }}
Every keys {{ ([1, 2, 3] has every (v, k) => 42 > k) ? 'match' : 'do not match' }}
```
Commits
-------
009bb4fd Add "some" and "every" filters
2022-12-26 17:18:29 +01:00
Fabien Potencier
589655c1b9
Re-enable Drupal integration tests
2022-12-26 13:27:08 +01:00
Fabien Potencier
201baa76a6
Merge branch '2.x' into 3.x
...
* 2.x:
Do more Github actions updates
Use checkout actions v3
Add PHP 8.2 to the tests
Remove a test that was a regression test for the C extension
2022-12-26 13:19:29 +01:00
Fabien Potencier
ef7a5ef2e3
Remove a test that was a regression test for the C extension
2022-12-26 12:42:02 +01:00
Fabien Potencier
e5c87f8821
Merge branch '2.x' into 3.x
...
* 2.x:
Add output
Fix the drupal testing script
Add missing argument for the cycle function
2022-12-15 11:46:42 +01:00
Christophe Coevoet
f3b8c01262
Fix the drupal testing script
2022-12-15 11:35:27 +01:00
Fabien Potencier
2e8acd94ca
Merge branch '2.x' into 3.x
...
* 2.x:
Fix a security issue on filesystem loader (possibility to load a template outside a configured directory)
2022-09-28 10:36:55 +02:00