Commit Graph

7332 Commits

Author SHA1 Message Date
Fabien Potencier 2d741f9a16 bug #4731 Fix spread operator behavior (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix spread operator behavior

Closes #4637

Commits
-------

2376bbaf3e Fix spread operator behavior
2026-01-13 10:14:41 +01:00
Fabien Potencier c034e0ba76 minor #4732 Fix deprecations (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix deprecations

Commits
-------

8391928896 Fix deprecations
2026-01-12 10:13:47 +01:00
Fabien Potencier 8391928896 Fix deprecations 2026-01-12 09:52:14 +01:00
Fabien Potencier 2376bbaf3e Fix spread operator behavior 2026-01-12 08:54:38 +01:00
Fabien Potencier 92f5098ad5 minor #4727 Fix CHANGELOG (usarise)
This PR was merged into the 3.x branch.

Discussion
----------

Fix CHANGELOG

Commit [Support for invoking closures](https://github.com/twigphp/Twig/commit/918f52e818f7c56e90ec462ae90b230da244a7ed) was added after release 3.17.1 https://github.com/twigphp/Twig/commits/v3.18.0

Commits
-------

97ff597b8a Fix CHANGELOG
2026-01-09 18:53:33 +01:00
Fabien Potencier a7436995d4 minor #4730 Fix intl-extra tests (Jean-Beru)
This PR was merged into the 3.x branch.

Discussion
----------

Fix intl-extra tests

Fix CI since `Scripts::getNames()` returns 4 new values. It just tests if the value is an array to limit maintenance on future updates.

Commits
-------

683adc550f Fix intl-extra tests
2026-01-08 19:56:46 +01:00
hubert.lenoir 683adc550f Fix intl-extra tests 2026-01-08 18:09:48 +01:00
Fabien Potencier 90acdc54f6 minor #4729 Fix tiny typo in CI step name (smnandre)
This PR was merged into the 3.x branch.

Discussion
----------

Fix tiny typo in CI step name

Just a nano-typo there in a step name

`symfony/translation-contract`+`s`

Commits
-------

949f351458 Fix tiny typo in CI workflow label
2026-01-06 08:05:11 +01:00
Simon André 949f351458 Fix tiny typo in CI workflow label
Just a nano-typo there

"symfony/translation-contract" -> "symfony/translation-contract**s**"
2026-01-05 22:50:27 +01:00
Fabien Potencier 4537dff30b Fix typo 2026-01-05 21:37:31 +01:00
Fabien Potencier 118a3a741e bug #4728 Fix opcache preload warning for unlinked anonymous class (OndraM)
This PR was merged into the 3.x branch.

Discussion
----------

Fix opcache preload warning for unlinked anonymous class

This fixes PHP opcache preload warning, caused by https://github.com/php/php-src/issues/10131 .  The warning is now produced when the preload is initiated.

> Can't preload unlinked class Twig\ExpressionParser\Infix\BinaryOperatorExpressionParser@anonymous: Unknown parent Twig\ExpressionParser\Infix\BinaryOperatorExpressionParser

This started with Twig 3.21, when the anonymous class started to be used in ExtensionSet.

This is a similar woraround as is already used in a TwigBridge, as suggested by `@nicolas`-grekas here https://github.com/symfony/symfony/pull/38533
Also similar fix is in API platform: https://github.com/api-platform/core/pull/3827

Commits
-------

86997d1bef Fix opcache preload warning for unlinked anonymous class
2026-01-05 21:36:53 +01:00
Ondřej Machulda 86997d1bef Fix opcache preload warning for unlinked anonymous class 2026-01-05 19:11:58 +01:00
usarise 97ff597b8a Fix CHANGELOG 2025-12-26 21:33:38 +07:00
Fabien Potencier 6e38bec2ee minor #4718 Add .gitignore & .gitattributes to all .gitattributes (jmsche)
This PR was merged into the 3.x branch.

Discussion
----------

Add .gitignore & .gitattributes to all .gitattributes

Commits
-------

ff327e4163 Add .gitignore & .gitattributes to all .gitattributes
2025-12-18 21:46:15 +01:00
Fabien Potencier aa8635647f Bump version 2025-12-14 12:29:52 +01:00
Fabien Potencier 946ddeafa3 Prepare the 3.22.2 release v3.22.2 2025-12-14 12:28:47 +01:00
Fabien Potencier eca0d9c7b9 Update CHANGELOG 2025-12-14 12:27:39 +01:00
Fabien Potencier cf87925346 bug #4724 Avoid ord deprecation notice in PHP 8.5 (iquito)
This PR was merged into the 3.x branch.

Discussion
----------

Avoid ord deprecation notice in PHP 8.5

Change the one usage of `ord()` in Twig where a multibyte character can trigger the new deprecation in PHP 8.5, which is in the `html_attr` escape functionality in EscaperRuntime, currently leading to:

```
ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead"
```

This small change fixes it. There are no other usages of `ord()` in Twig which lead to this deprecation notice.

Commits
-------

4d98cce4e4 Avoid ord deprecation in PHP 8.5
2025-12-14 12:27:12 +01:00
Fabien Potencier 537b4f2899 Update CHANGELOG 2025-12-14 12:17:55 +01:00
Andreas 4d98cce4e4 Avoid ord deprecation in PHP 8.5
Change the one usage of ord() in Twig where a multibyte character can trigger the new deprecation in PHP 8.5, which is in the `html_attr` escape functionality, previously leading to:

ord(): Providing a string that is not one byte long is deprecated. Use ord($str[0]) instead"
2025-12-14 11:29:02 +01:00
Fabien Potencier 4f323346a3 Add split.sh config 2025-12-05 11:47:00 +01:00
Fabien Potencier 8308f7fa24 bug #4722 use getShareDir as an indicator of Symfony version (tacman)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

use getShareDir as an indicator of Symfony version

Proposal to fix #4719 , replaces #4721

Commits
-------

c4dcd0bb8c use getShareDir as an indicator of Symfony version
2025-12-05 09:51:55 +01:00
Tac Tacelosky c4dcd0bb8c use getShareDir as an indicator of Symfony version 2025-12-05 09:51:53 +01:00
jmsche ff327e4163 Add .gitignore & .gitattributes to all .gitattributes 2025-12-02 15:45:16 +01:00
Fabien Potencier 8074ddcab8 minor #4714 Add 'invoke' to filters index (webda2l)
This PR was merged into the 3.x branch.

Discussion
----------

Add 'invoke' to filters index

Missing from https://github.com/twigphp/Twig/pull/4518 I think.

Commits
-------

f7daf71acc Add 'invoke' to filters index
2025-11-27 06:52:14 +01:00
David ALLIX f7daf71acc Add 'invoke' to filters index 2025-11-26 20:33:56 +01:00
Fabien Potencier ce6698abd5 bug #4713 Fix cycle() with non-countable ArrayAccess+Traversable objects (yoeunes)
This PR was merged into the 3.x branch.

Discussion
----------

Fix cycle() with non-countable ArrayAccess+Traversable objects

When using `cycle()` with an object that implements `\ArrayAccess` and `\Traversable` but is not `\Countable`, the function currently returns the object instance immediately after triggering the deprecation notice.

This prevents the value from being converted to an array, causing the cycle logic to fail or return the object itself.

This PR removes the early return to ensure `self::toArray()` is called, allowing these objects to be cycled correctly as expected.

**How to test**

```php
$seq = new class implements \ArrayAccess, \IteratorAggregate {
    public function offsetExists($offset): bool { return true; }
    public function offsetGet($offset): mixed { return 'val'; }
    public function offsetSet($offset, $value): void {}
    public function offsetUnset($offset): void {}
    public function getIterator(): \Traversable { yield 'odd'; yield 'even'; }
};

// Should return 'odd', currently returns the $seq object
$result = CoreExtension::cycle($seq, 0);
```

Related to #4241

Commits
-------

473653d19b [Core] Fix cycle() with non-countable ArrayAccess+Traversable objects
2025-11-25 07:55:14 +01:00
Younes ENNAJI 473653d19b [Core] Fix cycle() with non-countable ArrayAccess+Traversable objects 2025-11-23 13:20:23 +01:00
Fabien Potencier 2b7cc0ba9f minor #4712 Update .gitattributes to exclude phpstan configs (williamdes)
This PR was merged into the 3.x branch.

Discussion
----------

Update .gitattributes to exclude phpstan configs

They where added in https://github.com/twigphp/Twig/pull/4458

Versions >= 3.16.0 have the not needed files

Commits
-------

2e0c874776 Update .gitattributes to exclude phpstan configs
2025-11-19 18:29:21 +01:00
William Desportes 2e0c874776 Update .gitattributes to exclude phpstan configs 2025-11-19 14:18:11 +01:00
Fabien Potencier 34e874e536 Bump version 2025-11-16 17:02:42 +01:00
Fabien Potencier 1de2ec1fc4 Prepare the 3.22.1 release v3.22.1 2025-11-16 17:01:12 +01:00
Fabien Potencier 6a6543462b Update CHANGELOG 2025-11-15 09:10:04 +01:00
Fabien Potencier 35a3de7012 minor #4711 CoreExtension : Make error message more readable (tcoch)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

`CoreExtension` : Make error message more readable

It's a silly little patch, but really improves the readability of the error message IMO ...

Commits
-------

40248e4ca9 `CoreExtension` : Make error message more readable
2025-11-15 08:57:38 +01:00
Thomas Cochard 40248e4ca9 CoreExtension : Make error message more readable 2025-11-15 08:57:35 +01:00
Fabien Potencier d58c8be15d minor #4698 Add throw tag to parse methods (VincentLanglet)
This PR was merged into the 3.x branch.

Discussion
----------

Add throw tag to parse methods

Hi `@fabpot`, with PHPStan improving every day his exception checking, it's useful to have well documented method.

I didn't update all of them (there are too many), and focus on the one I have issue with:
- Almost all the InfixExpressionParserInterface/PrefixExpressionParserInterface implements throws a SyntaxError in parse method
- Parser::parse method is catching SyntaxError and rethrowing them so it should be added to the phpdoc
- Since Parser::parse catch Parser::subparse, it would be useful to add the phpdoc to subparse

Commits
-------

790eee7ae0 Add throw tag to parse methods
2025-11-05 13:48:28 +01:00
Fabien Potencier 2996f0b427 minor #4709 Add caution note for random function usage (xelan)
This PR was merged into the 3.x branch.

Discussion
----------

Add caution note for random function usage

See https://www.php.net/manual/en/function.array-rand.php and https://www.php.net/manual/en/function.mt-rand.php. Users should know that the Twig function is a convenience feature, but unusable e.g. for serious gaming/gambling apps due to the potential predictability and limited value range.

Commits
-------

02c5a4b0b6 Add caution note for random function usage
2025-11-04 14:12:13 +01:00
Andreas Erhard 02c5a4b0b6 Add caution note for random function usage 2025-11-04 11:55:35 +01:00
Fabien Potencier 94a363525d minor #4708 Allow Symfony 8 packages in Twig extra packages (javiereguiluz)
This PR was merged into the 3.x branch.

Discussion
----------

Allow Symfony 8 packages in Twig extra packages

I'm testing the upcoming Symfony 8 in some apps, and I have some issues with some Twig extra packages that don't allow installing Symfony 8 packages.

Commits
-------

9a8a1dc1dd Allow Symfony 8 packages in Twig extra packages
2025-11-02 20:01:59 +01:00
Javier Eguiluz 9a8a1dc1dd Allow Symfony 8 packages in Twig extra packages 2025-11-02 12:00:49 +01:00
Fabien Potencier 80fa13c253 minor #4707 Fix array typehint for $variants in HtmlExtension (yoeunes)
This PR was merged into the 3.x branch.

Discussion
----------

Fix array typehint for $variants in HtmlExtension

This PR corrects the array typehint for the `$variants` parameter in the `HtmlExtension::htmlCva` method. It was missing a closing angle bracket (`>`).

Commits
-------

64c87eeaa3 Fix array typehint for $variants in HtmlExtension
2025-10-30 07:16:57 -04:00
Younes ENNAJI 64c87eeaa3 Fix array typehint for $variants in HtmlExtension 2025-10-30 01:26:03 +01:00
Fabien Potencier f663cc345b Bump version 2025-10-29 11:57:52 -04:00
Fabien Potencier 4509984193 Prepare the 3.22.0 release v3.22.0 2025-10-29 11:56:47 -04:00
Fabien Potencier a5487c8e05 Update CHANGELOG 2025-10-29 11:53:10 -04:00
Fabien Potencier 9a5887a9fa bug #4704 Fix accessing arrays with stringable objects as key (nicolas-grekas)
This PR was merged into the 3.x branch.

Discussion
----------

Fix accessing arrays with stringable objects as key

Fix #4701

Commits
-------

9ae75d315c Fix accessing arrays with stringable objects as key
2025-10-29 11:47:18 -04:00
Nicolas Grekas 9ae75d315c Fix accessing arrays with stringable objects as key 2025-10-24 14:19:16 +02:00
Fabien Potencier d26e8f2b74 minor #4699 Update inky_to_html.rst: Updating link (ThomasLandauer)
This PR was merged into the 3.x branch.

Discussion
----------

Update inky_to_html.rst: Updating link

Page: https://twig.symfony.com/doc/3.x/filters/inky_to_html.html

Commits
-------

b9a4e04731 Update inky_to_html.rst: Updating link
2025-10-20 11:04:47 +02:00
Thomas Landauer b9a4e04731 Update inky_to_html.rst: Updating link
Page: https://twig.symfony.com/doc/3.x/filters/inky_to_html.html
2025-10-19 19:03:40 +02:00
Vincent Langlet 790eee7ae0 Add throw tag to parse methods 2025-10-18 12:28:49 +02:00