Commit Graph

6205 Commits

Author SHA1 Message Date
Fabien Potencier c44bd1ff62 Optimize TextNodes 2024-01-10 20:22:00 +01:00
Fabien Potencier b4c3c1c448 bug #3957 rework the CaptureNode implementation (xabbuh)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

rework the CaptureNode implementation

fixes #3955

Commits
-------

665dce89 rework the CaptureNode implementation
2024-01-01 15:44:03 +01:00
Christian Flothmann 665dce899f rework the CaptureNode implementation 2024-01-01 15:43:59 +01:00
Fabien Potencier 3f70efae53 feature #3954 Abstract node capture in its own Node (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Abstract node capture in its own Node

To prepare the work for #3950, I'd like to abstract the usage of `echo` into a single node that can be reused by other nodes.

The cache node is a good example of defining something that is more semantic are reusable as well. The node itself now just generates the wrapper that can then be returned, echoed, yielded, ...

Commits
-------

6ebbc305 Abstract node capture in its own Node
2023-12-30 13:02:32 +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 61fff2dba2 minor #3952 Fix intl tests (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix intl tests

Commits
-------

44b3bac5 Fix intl tests
2023-12-24 09:45:15 +01:00
Fabien Potencier 44b3bac552 Fix intl tests 2023-12-24 09:42:15 +01:00
Fabien Potencier e7261632f3 minor #3853 Improve error message for constant(FQCN::class) (MalteWunsch)
This PR was merged into the 3.x branch.

Discussion
----------

Improve error message for `constant(FQCN::class)`

It is not obvious that you cannot use the Twig function `constant` to get the special `::class` constants of classes like so: `{{ constant('Twig\\Extension\\CoreExtension::class') }}`, due to the underlying PHP function `\constant()`.

The previous error message
> Constant "Twig\Extension\CoreExtension::class" is undefined.

was generally helpful, but in this special case it was a bit misleading.

An alternative might be to determine and return the FCQN (e.g. via `substr($constant, 0, -7)`), but I'm not sure if this would be too much of a guess.

Commits
-------

3963851a Improve error message
2023-12-22 08:51:32 +01:00
Malte Wunsch 3963851a41 Improve error message
It is not obvious that you cannot use the Twig function `constant` to get the special `::class` constants of classes like so: `{{ constant('Twig\\Extension\\CoreExtension::class') }}`, due to the underlying PHP function `\constant()`.

The previous error message in this case: 'Constant "Twig\Extension\CoreExtension::class" is undefined.' was not very helpful.
2023-12-22 08:51:25 +01:00
Fabien Potencier 4c621adb49 Bump version 2023-12-22 08:35:50 +01:00
Fabien Potencier d77586da99 Update CHANGELOG 2023-12-22 08:34:46 +01:00
Fabien Potencier 7072a7256e bug #3949 Simplify code when using ob_* functions (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Simplify code when using `ob_*` functions

And fixed an edge case (see the modified test).

Commits
-------

0b9e30e3 Simplify code
2023-12-20 20:46:37 +01:00
Fabien Potencier 0b9e30e3d2 Simplify code 2023-12-20 20:43:49 +01:00
Fabien Potencier 83dfc0f823 bug #3948 Simplify sandbox tests (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Simplify sandbox tests

This allows to remove some unneeded assertions and fix static analysis checks.

Commits
-------

bc22e38c Fix bad merge
e6a98a00 Fix test without any assertions
fca89954 Simplify tests
2023-12-20 20:37:13 +01:00
Fabien Potencier bc22e38ce6 Fix bad merge 2023-12-20 20:34:40 +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
Fabien Potencier a4974b29a0 feature #3893 Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source (YSaxon)
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source

This is needed to patch some downstream vulnerabilities which I won't describe here.
I wrote `@fabpot` an email about this with more details a few weeks ago.

Generally the Sandbox can be enabled for a given template in either of two ways:
* Globally
* Including the template from another template in which we use the sandbox tag or parameter

This pull request adds a third way
* Using a SourcePolicy to selectively sandbox templates based on their Source object

Commits
-------

a18da161 Add SourcePolicyInterface to selectively enable the Sandbox based on a template's Source
2023-12-19 08:18:38 +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 d2f493f67c minor #3941 add docs & links (lacpandore)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

add docs & links

Commits
-------

dd24d5bf add docs & links
2023-12-14 08:17:08 +01:00
Louis-Arnaud dd24d5bfd2 add docs & links 2023-12-14 08:17:06 +01:00
Fabien Potencier 804cb1b85b feature #3883 Deprecate internal extension functions in favor of methods on the extension classes (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Deprecate internal extension functions in favor of methods on the extension classes

~~PoC on a simple extension for now.~~

Commits
-------

aa7c454e Fix CS
54d34b96 Move functions for CoreExtension
72071e8e Move functions for EscaperExtension
196e91dd Move functions for StringLoaderExtension
d4d01603 Move functions for DebugExtension
69a89e0e Move functions for MarkdownExtension
e07e9b5b Move functions for InkyExtension
bff189f1 Move functions for CssInlinerExtension
6a18cda5 Move functions for HtmlExtension
16abb69d Deprecate internal extension functions in favor of methods on the extension classes
2023-12-10 20:42:55 +01:00
Fabien Potencier aa7c454e2d Fix CS 2023-12-10 20:34:32 +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 69a89e0e77 Move functions for MarkdownExtension 2023-12-09 18:39:03 +01:00
Fabien Potencier e07e9b5be3 Move functions for InkyExtension 2023-12-09 18:39:03 +01:00
Fabien Potencier bff189f19a Move functions for CssInlinerExtension 2023-12-09 18:39:03 +01:00
Fabien Potencier 6a18cda5aa Move functions for HtmlExtension 2023-12-09 18:39:01 +01:00
Fabien Potencier 16abb69d12 Deprecate internal extension functions in favor of methods on the extension classes 2023-12-09 18:11:17 +01:00
Fabien Potencier d602a55603 Tweak deprecated docs 2023-12-09 17:48:07 +01:00
Fabien Potencier f83b415386 Merge branch '2.x' into 3.x
* 2.x:
  update Blackfire documentation URL
  Prepare the 2.15.6 release
  Update CHANGELOG
2023-12-09 12:45:27 +01:00
Fabien Potencier ec57248c14 minor #3929 update Blackfire documentation URL (Ca-Jou)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead.

Discussion
----------

update Blackfire documentation URL

Update Blackfire documentation's URL in README file

Commits
-------

ed2cfbd6 update Blackfire documentation URL
2023-12-09 12:44:06 +01:00
Ca-Jou ed2cfbd6f0 update Blackfire documentation URL 2023-12-09 12:44:01 +01:00
Fabien Potencier aeeec9a5e9 Bump version 2023-11-21 19:55:42 +01:00
Fabien Potencier 9d15f0ac07 Prepare the 3.8.0 release v3.8.0 2023-11-21 19:54:41 +01:00
Fabien Potencier b65ccdfb7d Update CHANGELOG 2023-11-21 19:53:58 +01:00
Fabien Potencier ad637405a8 Prepare the 2.15.6 release v2.15.6 2023-11-21 18:34:48 +01:00
Fabien Potencier a41a0e7fa5 Update CHANGELOG 2023-11-21 18:34:15 +01:00
Fabien Potencier 78e1cdd84c bug #3903 Fix timezone fallback to CoreExtension in IntlExtension (keulinho)
This PR was merged into the 3.x branch.

Discussion
----------

Fix timezone fallback to CoreExtension in IntlExtension

This is probably a regression from #3844

Refer to my comment on the original MR: https://github.com/twigphp/Twig/pull/3844#issuecomment-1792464040

Commits
-------

144c4dac Fix timezone fallback to CoreExtension in IntlExtension
2023-11-21 18:27:48 +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 ff98249d0b minor #3911 Add PHP 8.3 to the CI (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add PHP 8.3 to the CI

Commits
-------

a04cc88a Add PHP 8.3 to the CI
2023-11-21 16:50:45 +01:00
Fabien Potencier a04cc88ad7 Add PHP 8.3 to the CI 2023-11-21 16:47:02 +01:00
Fabien Potencier e6ba716520 minor #3908 Bump dependencies (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Bump dependencies

Commits
-------

fdb9d9ed Bump dependencies
2023-11-21 16:45:18 +01:00
Fabien Potencier fdb9d9eddf Bump dependencies 2023-11-21 15:02:01 +01:00
Fabien Potencier 6f74d5b7d6 minor #3909 Fix tests and CS (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix tests and CS

Commits
-------

4be326ae Fix tests and CS
2023-11-21 15:01:23 +01:00