Commit Graph

8183 Commits

Author SHA1 Message Date
Fabien Potencier d266b2df7f Merge branch '3.x' into 4.x
* 3.x:
  Clarify the security scope for untrusted templates
  Normalize destructuring assignment targets
  Deprecate duplicate macro definitions

# Conflicts:
#	CHANGELOG
#	doc/deprecated.rst
#	tests/ExpressionParserTest.php
2026-07-28 09:58:56 +02:00
Fabien Potencier ccc4a80ba7 documentation #4875 Clarify the security scope for untrusted templates (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Clarify the security scope for untrusted templates

Commits
-------

222a7f3f9a Clarify the security scope for untrusted templates
2026-07-28 09:51:25 +02:00
Fabien Potencier 222a7f3f9a Clarify the security scope for untrusted templates 2026-07-28 08:40:21 +02:00
Fabien Potencier 239cf25362 feature #4874 Normalize destructuring assignment targets (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Normalize destructuring assignment targets

Commits
-------

6ce5beb7c2 Normalize destructuring assignment targets
2026-07-27 18:57:15 +02:00
Fabien Potencier 6ce5beb7c2 Normalize destructuring assignment targets 2026-07-27 18:51:15 +02:00
Fabien Potencier 44f6f7e6c8 feature #4873 Deprecate duplicate macro definitions (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate duplicate macro definitions

Commits
-------

258089b8a6 Deprecate duplicate macro definitions
2026-07-27 12:45:09 +02:00
Fabien Potencier 258089b8a6 Deprecate duplicate macro definitions 2026-07-27 12:24:45 +02:00
Fabien Potencier 289f6a4a77 Fix merge conflict resolution 2026-07-26 07:53:49 +02:00
Fabien Potencier 19e6f46b90 Merge branch '3.x' into 4.x
* 3.x:
  Reuse assignment targets parsed for the for tag
  add shadowing example
  Update for.rst
  Fix IntlExtension ignoring explicit formats when a date formatter prototype is set
  bump Twig version metadata

# Conflicts:
#	CHANGELOG
#	doc/tags/for.rst
#	src/Environment.php
#	src/TokenParser/ForTokenParser.php
2026-07-26 07:52:24 +02:00
Fabien Potencier 293d05504b tidy #4872 Reuse assignment targets parsed for the for tag (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Reuse assignment targets parsed for the for tag

`ForTokenParser` rebuilds the loop targets returned by `parseAssignmentExpression()` into new `AssignContextVariable` instances, copying only the name and line number. But the parsed targets are already `AssignContextVariable` nodes with exactly those values, so the rebuild is a no-op left over from older Twig versions where for-targets were parsed as general expressions and needed normalizing.

Reusing the parsed nodes directly removes dead code, and makes the parser more robust: any metadata attached to the targets during parsing (now or in the future) is preserved instead of being silently dropped.

Commits
-------

9408f2a3f1 Reuse assignment targets parsed for the for tag
2026-07-25 18:00:28 +02:00
Fabien Potencier 9408f2a3f1 Reuse assignment targets parsed for the for tag 2026-07-25 17:48:54 +02:00
Fabien Potencier 7f94646a3b documentation #4862 Update for.rst (marilenaRM, Marilena Ruffelaere)
This PR was merged into the 3.x branch.

Discussion
----------

Update for.rst

Add context and explanation about loop.parent.

Commits
-------

02382585e9 add shadowing example
7234d51ec8 Update for.rst
2026-07-21 13:07:40 +02:00
Marilena Ruffelaere 02382585e9 add shadowing example 2026-07-20 18:57:40 +02:00
Fabien Potencier 66cb19fa98 bug #4867 Fix PHPStan errors on 4.x (fabpot)
This PR was merged into the 4.x branch.

Discussion
----------

Fix PHPStan errors on 4.x

Commits
-------

5e726bcce1 Fix PHPStan errors on 4.x
2026-07-19 18:22:03 +02:00
Fabien Potencier 5e726bcce1 Fix PHPStan errors on 4.x 2026-07-19 18:19:21 +02:00
Fabien Potencier 7d8248fb5f tidy #4866 ⚰️ Drop useless php comparisons (homersimpsons)
This PR was merged into the 4.x branch.

Discussion
----------

⚰️ Drop useless php comparisons

Commits
-------

f2e549a92b ⚰️ Drop useless php comparisons
2026-07-19 17:50:53 +02:00
Guillaume f2e549a92b ⚰️ Drop useless php comparisons 2026-07-18 18:06:34 +02:00
Marilena RUFFELAERE 7234d51ec8 Update for.rst
Add context and explanation about loop.parent
2026-07-17 15:42:51 +02:00
Fabien Potencier da8bd40700 bug #4859 Fix IntlExtension ignoring explicit formats when a date formatter prototype is set (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix IntlExtension ignoring explicit formats when a date formatter prototype is set

Closes #3845

Commits
-------

083b6dcabe Fix IntlExtension ignoring explicit formats when a date formatter prototype is set
2026-07-13 12:17:57 +02:00
Fabien Potencier 083b6dcabe Fix IntlExtension ignoring explicit formats when a date formatter prototype is set 2026-07-13 12:17:54 +02:00
Fabien Potencier ebd4d16d8a tidy #4861 bump Twig version metadata (xabbuh)
This PR was merged into the 3.x branch.

Discussion
----------

bump Twig version metadata

following #4852

Commits
-------

57905dab67 bump Twig version metadata
2026-07-13 12:14:31 +02:00
Christian Flothmann 57905dab67 bump Twig version metadata 2026-07-13 10:56:44 +02:00
Fabien Potencier d659593774 Merge branch '3.x' into 4.x
* 3.x:
  Document sandbox handling of magic __call() methods
  Add sandbox tests for methods routed through __call()

# Conflicts:
#	doc/sandbox.rst
#	tests/Extension/SandboxTest.php
2026-07-12 15:56:39 +02:00
Fabien Potencier bfbd962c5f tidy #4858 Document and test sandbox __call support (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Document and test sandbox __call support

Related to #1950

Commits
-------

29b66fd916 Document sandbox handling of magic __call() methods
72da20aeb7 Add sandbox tests for methods routed through __call()
2026-07-12 15:54:43 +02:00
Fabien Potencier 29b66fd916 Document sandbox handling of magic __call() methods 2026-07-12 15:45:50 +02:00
Fabien Potencier 72da20aeb7 Add sandbox tests for methods routed through __call() 2026-07-12 15:45:50 +02:00
Fabien Potencier 075dd703d0 Merge branch '3.x' into 4.x
* 3.x:
  Disable the fabbot test-case return type check
2026-07-12 15:39:22 +02:00
Fabien Potencier a5cbfabb83 tidy #4860 Disable the fabbot test-case return type check (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Disable the fabbot test-case return type check

See https://github.com/symfony-tools/fabbot/pull/18

Commits
-------

27a2dba4a7 Disable the fabbot test-case return type check
2026-07-12 15:39:13 +02:00
Fabien Potencier 27a2dba4a7 Disable the fabbot test-case return type check 2026-07-12 15:35:49 +02:00
Fabien Potencier 66bfbb27a8 Merge branch '3.x' into 4.x
* 3.x:
  Fix CS

# Conflicts:
#	src/Parser.php
#	src/Test/IntegrationTestCase.php
#	src/Test/NodeTestCase.php
2026-07-12 15:25:22 +02:00
Fabien Potencier 0b8e267bce Fix CS 2026-07-12 15:21:32 +02:00
Fabien Potencier 44f3c75117 Merge branch '3.x' into 4.x
* 3.x:
  Fix incompatible identifier() signature in test stubs
2026-07-12 15:16:40 +02:00
Fabien Potencier ef9c43187a Fix incompatible identifier() signature in test stubs 2026-07-12 15:15:28 +02:00
Fabien Potencier 5ca7debf6e Fix merge conflict resolution 2026-07-12 15:08:38 +02:00
Fabien Potencier 0b6e824ea8 Merge branch '3.x' into 4.x
* 3.x:
  Add void return type hint even in tests
  Run php-cs-fixer sequentially so the void_return src-only customiser is applied
  Fix CHANGELOG
  [Intl] Add format_list filter using PHP 8.5's IntlListFormatter

# Conflicts:
#	.github/workflows/ci.yml
#	CHANGELOG
#	extra/cssinliner-extra/Tests/LegacyFunctionsTest.php
#	extra/html-extra/Tests/CvaTest.php
#	extra/html-extra/Tests/HtmlAttrMergeTest.php
#	extra/html-extra/Tests/HtmlAttrTest.php
#	extra/html-extra/Tests/LegacyFunctionsTest.php
#	extra/inky-extra/Tests/LegacyFunctionsTest.php
#	extra/markdown-extra/Tests/FunctionalTest.php
#	extra/markdown-extra/Tests/LegacyFunctionsTest.php
#	extra/twig-extra-bundle/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php
#	extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php
#	extra/twig-extra-bundle/TwigExtraBundle.php
#	src/Extension/CoreExtension.php
#	src/Extension/EscaperExtension.php
#	src/Node/CheckSecurityCallNode.php
#	src/Node/Expression/FunctionExpression.php
#	src/Node/ModuleNode.php
#	src/Node/Node.php
#	src/Node/TypesNode.php
#	src/Resources/core.php
#	src/Resources/debug.php
#	src/Test/IntegrationTestCase.php
#	tests/CustomExtensionTest.php
#	tests/EnvironmentTest.php
#	tests/ExpressionParserTest.php
#	tests/Extension/CoreTest.php
#	tests/Extension/EscaperTest.php
#	tests/Extension/LegacyDebugFunctionsTest.php
#	tests/Extension/LegacyStringLoaderFunctionsTest.php
#	tests/Extension/SandboxStateChangeTest.php
#	tests/Extension/SandboxTest.php
#	tests/LexerTest.php
#	tests/Node/Expression/CallTest.php
#	tests/Node/Expression/ConditionalTest.php
#	tests/Node/NodeTest.php
#	tests/Resources/LegacyCoreTest.php
#	tests/TemplateTest.php
#	tests/Util/CallableArgumentsExtractorTest.php
2026-07-12 13:55:37 +02:00
Fabien Potencier 9c6d76b61c Add void return type hint even in tests 2026-07-12 13:43:08 +02:00
Fabien Potencier 71badee960 Run php-cs-fixer sequentially so the void_return src-only customiser is applied 2026-07-10 16:33:45 +02:00
Fabien Potencier 209a98402b Fix CHANGELOG 2026-07-08 22:23:12 +02:00
Fabien Potencier 5bcd992138 feature #4852 [Intl] Add format_list filter using PHP 8.5's IntlListFormatter (BreyndotEchse)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

[Intl] Add format_list filter using PHP 8.5's IntlListFormatter

Adds a new `format_list` Twig filter to IntlExtension that formats arrays using using PHP 8.5's IntlListFormatter

On PHP < 8.5, using the filter throws a RuntimeError explaining the dependency on IntlListFormatter (Checks if `class_exists` to allow polyfills).

CI workflow only covered up to PHP 8.4, so I extended it to also run PHPUnit against 8.5.
phpstan's PHP version also bumped to 8.5.

Commits
-------

163f1b6341 [Intl] Add format_list filter using PHP 8.5's IntlListFormatter
2026-07-08 22:22:47 +02:00
Marvin Feldmann 163f1b6341 [Intl] Add format_list filter using PHP 8.5's IntlListFormatter 2026-07-08 22:22:44 +02:00
Fabien Potencier 8b5e0a1957 Remove deprecated code 2026-07-08 21:35:57 +02:00
Fabien Potencier ea8aadf94d Merge branch '3.x' into 4.x
* 3.x:
  Exempt test files from the void_return rule regardless of the config location
  fix version in deprecation message for tag usage outside of root template
  Fix array access with a Stringable key on ArrayAccess objects using object keys
  Throw a SyntaxError instead of a PHP fatal error when a macro argument is defined twice
  Bump version
  Prepare the 3.28.0 release
  Render backed enums using their backing value in the html_attr function
  Tweak previous merge
  Add documention note about variable scope of override blocks in {% embed ... only %}
  Define the macro at the template root in the cache macro fixture
  Update CHANGELOG
  Fix a PHP 8.5 chr() deprecation when decoding octal string escapes
  Fix Markup truthiness in boolean expressions

# Conflicts:
#	CHANGELOG
#	doc/deprecated.rst
#	src/Environment.php
#	src/Node/Expression/TempNameExpression.php
#	src/Node/IfNode.php
#	src/Node/MacroNode.php
#	src/NodeVisitor/CorrectnessNodeVisitor.php
#	tests/Fixtures/tags/inheritance/extends_in_condition.test
#	tests/Fixtures/tags/inheritance/use_in_condition.test
#	tests/Fixtures/tags/inheritance/use_in_macro.test
#	tests/Fixtures/tags/macro/macro_in_block.test
#	tests/Fixtures/tags/macro/macro_in_condition.test
2026-07-08 21:22:49 +02:00
Fabien Potencier 4a7cd7057d Exempt test files from the void_return rule regardless of the config location 2026-07-08 21:16:09 +02:00
Fabien Potencier 8ada671fc3 bug #4856 Fix array access with a Stringable key on ArrayAccess objects using object keys (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix array access with a Stringable key on ArrayAccess objects using object keys

Closes #4855

Commits
-------

679b8fd610 Fix array access with a Stringable key on ArrayAccess objects using object keys
2026-07-08 21:15:02 +02:00
Fabien Potencier 2fb736d033 tidy #4857 Fix version in deprecation message for tag usage outside of root template (MrYamous)
This PR was merged into the 3.x branch.

Discussion
----------

Fix version in deprecation message for tag usage outside of root template

#4292 has been introduced in 3.28 and related deprecations are shown for this version in changelog file

But in some part of code including deprecation message, it's about 3.27, this is confusing when upgrading Twig

Commits
-------

fc4dee393c fix version in deprecation message for tag usage outside of root template
2026-07-08 20:57:26 +02:00
Matthieu Lempereur fc4dee393c fix version in deprecation message for tag usage outside of root template 2026-07-08 19:01:20 +02:00
Fabien Potencier 679b8fd610 Fix array access with a Stringable key on ArrayAccess objects using object keys 2026-07-06 22:42:11 +02:00
Fabien Potencier d1abdf483a bug #4853 Throw a SyntaxError instead of a PHP fatal error when a macro argument is defined twice (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Throw a SyntaxError instead of a PHP fatal error when a macro argument is defined twice

Commits
-------

0d283d304a Throw a SyntaxError instead of a PHP fatal error when a macro argument is defined twice
2026-07-04 11:20:43 +02:00
Fabien Potencier 0d283d304a Throw a SyntaxError instead of a PHP fatal error when a macro argument is defined twice 2026-07-04 11:17:28 +02:00
Fabien Potencier 54e5bc1453 Bump version 2026-07-03 22:44:56 +02:00