Fabien Potencier
c8d6df7eb2
Remove usage of isset before array_key_exists as performance is not an issue anymore
2023-12-09 17:24:12 +01:00
Fabien Potencier
bce22e4c32
Use named arguments
2023-12-09 17:18:55 +01:00
Fabien Potencier
be67e9690f
Use str_* when possible
2023-12-09 15:33:38 +01:00
Fabien Potencier
fed8dd102b
Use ::class
2023-12-09 15:33:38 +01:00
Fabien Potencier
b9cf29d53d
Remove obsolete code
2023-12-09 14:56:21 +01:00
Fabien Potencier
583d7b2d2c
Remove hack to inline throwing an exception
2023-12-09 14:52:04 +01:00
Fabien Potencier
bcfe41efff
Remove obsolete docs
2023-12-09 13:46:54 +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
Nicolas Grekas
163f07400a
Fix support for named closures
2022-05-13 17:01:54 +02:00
hubert.lenoir
009bb4fd82
Add "some" and "every" filters
2022-03-25 11:04:50 +01:00
Kévin Dunglas
0d6bd45844
add support for the class constant on objects
2022-03-25 09:58:48 +01:00
Fabien Potencier
3fef888756
Merge branch '2.x' into 3.x
...
* 2.x:
Add a test
Added token type and value to error message
Add phpdoc to SecurityPolicyInterface
2022-03-25 09:18:59 +01:00
Fabien Potencier
beea1a7c4a
Add a test
2022-03-25 09:18:53 +01:00
Fabien Potencier
5aaf393a11
Remove legacy test
2022-03-25 09:10:15 +01:00