795 Commits

Author SHA1 Message Date
Fabien Potencier 3ffcf4b7d8 Prepare the 3.5.0 release 2022-12-27 13:28:18 +01:00
Fabien Potencier 0c8f5b2ea4 Bump version to 3.5 2022-12-27 13:23:36 +01:00
Fabien Potencier a82e94d911 Add some tests 2022-12-27 12:31:54 +01:00
Matheo Daninos 61672c43f9 throwing syntaxt error when the matches regexp is not valid 2022-12-27 12:25:33 +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 93196e9eea feature #3788 Add Compile::reset() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add Compile::reset()

refs #3736

Commits
-------

824dbd9e Add Compile::reset()
2022-12-26 17:49:43 +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 824dbd9e21 Add Compile::reset() 2022-12-26 17:10:13 +01:00
Fabien Potencier fe347bbf1b Merge branch '2.x' into 3.x
* 2.x:
  Fix tests
  Updates CoreExtension::twig_constant to check for definition first to avoid hard crash
2022-12-26 16:12:53 +01:00
Fabien Potencier 6c2bb9fc8d bug #3769 Updates CoreExtension::twig_constant to check for definition first to avoid hard crash (Alex Henderson-Roche)
This PR was merged into the 2.x branch.

Discussion
----------

Updates CoreExtension::twig_constant to check for definition first to avoid hard crash

The behaviour of PHP's constant() method has been updated after https://github.com/php/php-src/issues/9905 was accepted and fixed in PHP 8.1 (and previously changed post PHP 8.0) . This PR prevents a fatal error in the case a constant is supplied that doesn't actually exist.

Commits
-------

56b31224 Updates CoreExtension::twig_constant to check for definition first to avoid hard crash
2022-12-26 13:36:08 +01:00
Alex Henderson-Roche 56b31224bd Updates CoreExtension::twig_constant to check for definition first to avoid hard crash 2022-12-26 13:36:01 +01:00
Fabien Potencier 705d7ce122 Merge branch '2.x' into 3.x
* 2.x:
  Fix optimizing closures callbacks
  Update templates.rst
2022-12-13 16:48:36 +01:00
Nicolas Grekas 406b3e5969 Fix optimizing closures callbacks 2022-12-12 16:33:12 +01:00
Vincent Langlet e98a652a6c Improve phpdoc of ExtensionInterface/Environment/Expressionparser arrays 2022-11-18 10:55:01 +01:00
Vincent Langlet de0f947efc Remove internal from ExpressionParser 2022-10-20 22:22:52 +02:00
Fabien Potencier efe6294cc2 Bump version 2022-09-28 10:43:58 +02:00
Fabien Potencier 7a2e23ce17 Bump version 2022-09-28 10:43:25 +02:00
Fabien Potencier c38fd6b0b7 Prepare the 3.4.3 release 2022-09-28 10:42:51 +02:00
Fabien Potencier ab402673db Prepare the 2.15.3 release 2022-09-28 10:40:08 +02: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 8b0d9e729f Bump version 2022-08-12 08:48:31 +02:00
Fabien Potencier e07cdd3d43 Prepare the 3.4.2 release 2022-08-12 08:47:24 +02:00
Fabien Potencier 48fba37310 Bump version 2022-08-12 08:44:42 +02:00
Fabien Potencier 3e43405a9a Prepare the 2.15.2 release 2022-08-12 08:43:37 +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 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 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 a1f8d3f91a Bump version 2022-05-17 07:49:32 +02:00
Fabien Potencier e939eae923 Prepare the 3.4.1 release 2022-05-17 07:48:52 +02:00
Fabien Potencier fcc900cf80 Bump version 2022-05-17 07:47:36 +02:00
Fabien Potencier 3b7cedb2f7 Prepare the 2.15.1 release 2022-05-17 07:46:24 +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 9612dd4f13 Bump version 2022-05-15 08:26:19 +02:00
Fabien Potencier ed19f4bf9d Prepare the 3.4.0 release 2022-05-15 08:25:28 +02:00
Fabien Potencier 137b370376 Bump version 2022-05-15 08:24:02 +02:00
Fabien Potencier 2fcc95728f Prepare the 2.15.0 release 2022-05-15 08:21:48 +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
Fabien Potencier 321c5cbf20 Bump version 2022-04-06 08:48:37 +02:00
Fabien Potencier 8442df056c Prepare the 2.14.13 release 2022-04-06 08:47:41 +02:00
Fabien Potencier f6bd36a694 Bump version 2022-04-06 08:46:17 +02:00
Fabien Potencier 66856cd045 Prepare the 2.14.13 release 2022-04-06 08:45:17 +02:00
Fabien Potencier 9fb8b8dc68 Merge branch '2.x' into 3.x
* 2.x:
  Enable bytecode invalidation with auto_reload
2022-04-05 18:27:22 +02:00
Jérôme Tamarelle ef8ae9cb61 Enable bytecode invalidation with auto_reload 2022-04-05 18:17:00 +02:00
hubert.lenoir 009bb4fd82 Add "some" and "every" filters 2022-03-25 11:04:50 +01:00