Fabien Potencier
c44bd1ff62
Optimize TextNodes
2024-01-10 20:22:00 +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
Fabien Potencier
d6ea14aa84
Merge branch '1.x' into 2.x
...
* 1.x:
Fix a security issue on filesystem loader (possibility to load a template outside a configured directory)
2022-09-28 10:36:46 +02:00
Fabien Potencier
bcda6c3323
Merge branch '2.x' into 3.x
...
* 2.x:
Fix CS
Allow inherited magic method to still run with calling class
2022-08-12 08:33:18 +02:00
Fabien Potencier
f2cb718bdb
Fix CS
2022-08-12 08:33:05 +02:00
Fabien Potencier
f8009347c4
Fix a security issue on filesystem loader (possibility to load a template outside a configured directory)
2022-07-13 16:03:29 +02:00
Ben Thomson
d1457a40b6
Allow inherited magic method to still run with calling class
...
If a static method cannot be resolved to the calling class, but the calling class has, or inherits, a `__callStatic` handler, this allows the `__callStatic` handler to be used with the calling class, and not the inherited class as would occur with reflection. This allows systems such as Laravel facades to still work.
Fixes https://github.com/twigphp/Twig/issues/3716
2022-07-06 10:46:46 +02:00
Fabien Potencier
09760aa689
Merge branch '2.x' into 3.x
...
* 2.x:
Removed unneeded ext refs
2022-06-02 20:36:43 +02:00
Fabien Potencier
3aba62185d
Removed unneeded ext refs
2022-06-02 20:36:38 +02:00
Fabien Potencier
45a8317e61
Merge branch '2.x' into 3.x
...
* 2.x:
Fixes `CallExpression::reflectCallable()` throwing `TypeError`
2022-06-02 20:35:24 +02:00
ju1ius
e333ccc9f6
Fixes CallExpression::reflectCallable() throwing TypeError
2022-06-02 20:33:33 +02:00
Fabien Potencier
d90435f6be
Merge branch '2.x' into 3.x
...
* 2.x:
Fix optimizing non-public named closures
Bump version
Prepare the 2.15.0 release
2022-05-17 07:45:01 +02:00
Nicolas Grekas
dd34e9f5c9
Fix optimizing non-public named closures
2022-05-16 17:47:23 +02:00
Fabien Potencier
9ca7fb8799
Merge branch '2.x' into 3.x
...
* 2.x:
Fix support for named closures
2022-05-15 08:11:13 +02:00