Commit Graph

276 Commits

Author SHA1 Message Date
Fabien Potencier 54420847f0 Install a custom exception handler before bootstrapping KernelTestCase 2026-05-24 10:42:35 +02:00
Alexandre Daubois 6add9066fc Fix unbounded memoisation of IntlDateFormatter / NumberFormatter 2026-05-19 22:44:48 +02:00
Fabien Potencier b675555ea2 security #cve-2026-46637 Fix XSS and pre-escape input on HTML-emitting filters in the extras (nicolas-grekas)
This PR was squashed before being merged into the twig-3.x branch.
2026-05-19 22:37:15 +02:00
Nicolas Grekas e36489d352 Pre-escape HTML input on inline_css and inky_to_html filters
Both filters consume HTML on the input side. Adding `pre_escape => 'html'`
makes the autoescaper escape attacker-controlled inputs before the filters
process them, so they are no longer reachable via `{{ user_input|inline_css }}`
or `{{ user_input|inky_to_html }}` without an explicit `|raw`.
2026-05-15 15:14:14 +02:00
Nicolas Grekas 84982072c7 Fix XSS by adjusting is_safe annotation on HTML-emitting filters
The `html_to_markdown` filter emits plain Markdown text, so the
`is_safe` annotation is dropped entirely and autoescape now handles
its output according to the surrounding context.

The `markdown_to_html` and `inline_css` filters emit HTML, not text
safe in every escaping context, so `is_safe => ['all']` produced
unescaped HTML when their output was interpolated into a JS, CSS or
URL context. The annotation is now `is_safe => ['html']`.
2026-05-15 15:14:02 +02:00
Matthias Pigulla 25bfb5957c Add two tests for error conditions in #3930 2026-03-17 08:24:08 +01:00
Matthias Pigulla 42c12fa720 Add an html_attr function to make outputting HTML attributes easier 2026-03-17 07:39:33 +01:00
Fabien Potencier 861215c507 Fix CS 2026-02-07 09:07:38 +01:00
Felds Liscia 263c04fd1f Add null-safe operator 2026-01-17 14:57:47 +01:00
hubert.lenoir 683adc550f Fix intl-extra tests 2026-01-08 18:09:48 +01: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
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
Javier Eguiluz 9a8a1dc1dd Allow Symfony 8 packages in Twig extra packages 2025-11-02 12:00:49 +01:00
Younes ENNAJI 64c87eeaa3 Fix array typehint for $variants in HtmlExtension 2025-10-30 01:26:03 +01:00
Fabien Potencier 41bfb6bd8b Fix intl test 2025-09-15 08:05:04 +02:00
Fabien Potencier 8f970764e6 Bump minimum Commonmark requirement 2025-09-15 07:57:37 +02:00
Fabien Potencier e05e818761 bug #4653 Allow usage of other Markdown converters than CommonMark in LeagueMarkdown (xJuvi)
This PR was merged into the 3.x branch.

Discussion
----------

Allow usage of other Markdown converters than CommonMark in LeagueMarkdown

Since the `CommonMarkConverter` from `League\CommonMark` doesn't allow customizing the `Environment` class at construct-time, this simple change allows providing an instance the parent class, so we can both inject a config to the converter AND a custom list of extensions (like `CommonMarkCoreExtension`) via the constructor.

This PR fixes #3581

Commits
-------

81e66e96bf Update LeagueMarkdown.php
2025-08-02 15:26:08 +02:00
Nicolas Grekas fec73458dc minor #4664 CS fixes (nicolas-grekas)
This PR was merged into the 3.x branch.

Discussion
----------

CS fixes

Commits
-------

85a4817128 CS fixes
2025-07-29 10:10:06 +02:00
Nicolas Grekas 85a4817128 CS fixes 2025-07-29 10:07:07 +02:00
Nicolas Grekas b6a105c952 Fix compatibility with Symfony 8 2025-07-10 12:07:05 +02:00
Hannes 81e66e96bf Update LeagueMarkdown.php 2025-06-17 23:57:57 +02:00
Doeke Norg a8aadc3e99 Update configuration keys + allow extra keys for extensions 2025-05-23 09:29:36 +02:00
Alexandre Daubois 9c6b95f2a6 Make in_array() calls strict 2025-02-19 15:29:33 +01:00
Fabien Potencier 151aa4ecda Fix CS 2025-02-14 12:57:03 +01:00
Fabien Potencier 4695e33f73 Fix cache-extra impl 2025-02-14 11:27:48 +01:00
Fabien Potencier 251c0b5da9 Fix CS 2025-02-14 08:45:28 +01:00
Fabien Potencier f67078b5c4 Move Operators to ExpressionParsers, deprecate ExpressionParser 2025-02-14 08:38:53 +01:00
Fabien Potencier 40a2d5b57f Add missing CHANGELOG 2025-02-08 10:47:15 +01:00
Fabien Potencier 3cdf26fe76 feature #3737 Added configuration for commonmark use in twig-extra-bundle. (doekenorg)
This PR was merged into the 3.x branch.

Discussion
----------

Added configuration for commonmark use in twig-extra-bundle.

Following this tweet: https://twitter.com/ramsey/status/1561894460560138241, this PR adds the configuration options for `commonmark` to the `twig-extra-bundle`.

The configuration is added to the `LeagueCommonMarkConverterFactory` and in turn injected in the `CommonMarkConverter`. This way a user can provide the configuration for usage inside twig.

I'm not sure if adding the configuration inside the extension is the way to go.

Hope this helps out at least `@ramsey` :-)

Added `ignoreExtraKeys` to be somewhat future proof in case extra configuration is added later on, and also to be able to provide de configuration for extensions.

Commits
-------

6f20629622 Added configuration for commonmark use in twig-extra-bundle.
2025-02-08 10:44:24 +01:00
Fabien Potencier 3288d8d98d Reimplement the cache tag in an adhoc way 2025-02-03 12:49:20 +01:00
Fabien Potencier dc6356268b Bump min PHP version to 8.1 2025-01-31 21:45:36 +01:00
Christian Flothmann 18007078ba fix intl-extra tests 2025-01-24 21:20:33 +01:00
Fabien Potencier 93466404b7 feature #4550 Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments()

Commits
-------

960f6762ed Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments()
2025-01-24 14:36:45 +01:00
Fabien Potencier 960f6762ed Deprecate Twig\ExpressionParser::parseOnlyArguments() and Twig\ExpressionParser::parseArguments() 2025-01-23 08:35:56 +01:00
Fabien Potencier 76062c8d51 Fix CS 2025-01-19 16:54:05 +01:00
Nicolas Lemoine 8158dabc17 Add support for Twig\Markup
Co-authored-by: Fabien Potencier <fabien@potencier.org>
2024-12-29 11:29:59 +01:00
Fabien Potencier 2a6c986e85 Add a test 2024-12-18 07:46:55 +01:00
Nicolas Grekas 5287da57cc Require "erusev/parsedown": "dev-master as 1.x-dev" 2024-12-02 09:57:02 +01:00
Fabien Potencier 14fc89ebea Fix CS 2024-11-30 09:42:13 +01:00
Fabien Potencier 8c91bd7093 minor #4461 Fix the intl-extra tests (stof)
This PR was merged into the 3.x branch.

Discussion
----------

Fix the intl-extra tests

symfony/intl has updated its data from ICU 75.1 to ICU 76.1, which includes new currency and scripts.

Commits
-------

d69c66643f Fix the intl-extra tests
2024-11-20 17:23:39 +01:00
Christophe Coevoet d69c66643f Fix the intl-extra tests
symfony/intl has updated its data from ICU 75.1 to ICU 76.1, which
includes new currency and scripts.
2024-11-20 14:19:52 +01:00
Christophe Coevoet abc34bd263 Fix the string-extra tests when running with older symfony/string 2024-11-20 14:10:15 +01:00
Dennis Tobar 290a923a42 [String] Add SpanishInflector support for singular and plural 2024-11-03 15:08:48 +01:00
Fabien Potencier 4e08e3ef5f Fix tests 2024-09-30 08:41:48 +02:00
Fabien Potencier 0da899d911 Use get_debug_type() everywhere 2024-09-29 18:08:29 +02:00
Fabien Potencier a23cd9feeb Fix CS 2024-09-26 21:22:23 +02:00
Christian Flothmann c5486b07b9 fix intl-extra tests 2024-09-16 12:21:35 +02:00
Fabien Potencier a240eff47e Simplify code 2024-09-10 08:27:46 +02:00
Fabien Potencier 722a5fb027 feature #4266 Prepare IntegrationTestCase for static data providers (derrabus)
This PR was merged into the 3.x branch.

Discussion
----------

Prepare IntegrationTestCase for static data providers

Data providers need to be static in PHPUnit 11. Because of this, I'd like to declare the two methods we use as data providers in `IntegrationTestCase` as static in 4.0. This PR prepares that change:

* The non-static `getFixturesDir()` method is replaced with a static `getFixturesDirectory()`.
* Both methods `getTests()` and `getLegacyTests()` are marked as final, so we can declare them static in the next major.

This however means that we're delaying PHPUnit 11 compatibility of integration tests to Twig 4.0. If that's too late for us, we could deprecate the whole `IntegrationTestCase` in favor of a compatible replacement. That's a bigger change, but I would work on it if you think it's worth it.

Commits
-------

18f42038 Prepare IntegrationTestCase for static data providers
2024-09-03 22:17:35 +02:00