Fabien Potencier
60d3b3452a
Merge branch '3.x' into 4.x
...
* 3.x:
Add support for tempest/markdown in markdown-extra
Add the include_only function to render a template without access to the current context
Clarify duplicate macro deprecation message
Deduplicate template error handling
# Conflicts:
# .gitignore
# CHANGELOG
# extra/markdown-extra/composer.json
# src/Extension/CoreExtension.php
# src/Parser.php
# src/Template.php
# tests/Fixtures/macros/duplicate_definition.legacy.test
2026-08-16 10:57:50 +02:00
Fabien Potencier
e62abbf528
Deduplicate template error handling
2026-08-03 17:28:46 +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
8a4b77920a
Add PHPUnit attributes alongside annotations to silence doc-comment metadata deprecations on PHPUnit 11
2026-06-03 18:26:39 +02:00
Nicolas Grekas
c649c1658b
Merge branch '3.x' into 4.x
...
* 3.x:
CS fixes
Enable Fabbot as a GHA
2025-07-29 10:27:55 +02:00
Nicolas Grekas
85a4817128
CS fixes
2025-07-29 10:07:07 +02:00
Fabien Potencier
f97db8960a
Merge branch '3.x' into 4.x
...
* 3.x:
Avoid polluting ModuleNode::toString() with embedded templates
Simplify code
Add tests
Tweak Sandbox docs
Improve docs on creating new tags
remove not needed code
Remove obsolete comment
2025-02-28 08:59:42 +01:00
Fabien Potencier
da64c42dc2
Add tests
2025-02-28 08:52:34 +01:00
Fabien Potencier
4a3f02f0b8
Merge branch '3.x' into 4.x
...
* 3.x:
Move some tests
2025-02-26 22:11:29 +01:00
Fabien Potencier
56204e951a
Move some tests
2025-02-26 22:10:10 +01:00
Fabien Potencier
50cdb7bf4a
Remove usage of @dataProvider
2025-02-26 22:01:08 +01:00
Fabien Potencier
29a26782d0
Fix merge
2025-02-26 21:58:09 +01:00
Fabien Potencier
d5ea3f9fe4
Merge branch '3.x' into 4.x
...
* 3.x:
Fix Error when the trace has Twig file/line information instead of the original PHP info
Sync Error file and line
2025-02-26 21:57:20 +01:00
Fabien Potencier
7b43bd0fd7
Fix Error when the trace has Twig file/line information instead of the original PHP info
2025-02-26 21:02:58 +01:00
Fabien Potencier
4a121d90c6
Sync Error file and line
2025-02-26 13:26:24 +01:00
Fabien Potencier
e31d709627
Merge branch '3.x' into 4.x
...
* 3.x:
Improve error reporting
2025-02-22 18:28:19 +01:00
Fabien Potencier
d5dc3eee99
Improve error reporting
2025-02-22 10:22:21 +01:00
Fabien Potencier
28246c5d4e
Merge branch '3.x' into 4.x
...
* 3.x:
Fixing minor typo in Update inline_css.rst
Ignore static properties when using the dot operator
Fix CS
Fix constant() behavior when used with ??
Finish the work
fix indentation
Apply suggestions from code review
typo
fix merge
docs and changelog
typehint instead of checkArrow
checkArrow, typehints
invoke filter
2025-01-24 11:32:17 +01:00
Fabien Potencier
76062c8d51
Fix CS
2025-01-19 16:54:05 +01:00
Alexander M. Turek
f2053bbea0
PHPUnit 11
2024-09-04 12:11:51 +02:00
Alexander M. Turek
6ddb76bb76
Make data providers static
2024-09-03 16:32:00 +02:00
Fabien Potencier
0823d23488
Throw a SyntaxError exception at compile time when a Twig callable has not the minimum number of required arguments
2024-08-15 23:00:02 +02:00
Fabien Potencier
b63bde3063
Optimize sprintf() calls for PHP 8.4
2024-06-21 08:16:55 +02:00
Fabien Potencier
71e90fab7b
Remove some tests
2024-01-25 13:09:58 +01:00
Fabien Potencier
4fd62abb87
-
2024-01-25 13:09:58 +01:00
Fabien Potencier
3b6cbf98d8
Remove usage of ob_* functions in favor of yielding
2024-01-25 13:09:52 +01:00
Drew Richards
85bf01b4ab
Catch errors thrown during template rendering
2023-10-26 17:55:48 -07:00
Fabien Potencier
157fa56829
Merge branch '1.x' into 2.x
...
* 1.x:
Fix CS
Migrate to the new PHP CS Fixer config file
2021-05-12 09:27:30 +02:00
Fabien Potencier
59f3e8e5dc
Fix CS
2021-05-12 09:19:37 +02:00
Fabien Potencier
ab6695b580
Merge branch '1.x' into 2.x
...
* 1.x:
Fix sandbox support when using include(template_from_string())
Add test to verify that filter is not working when template_from_string is used.
In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
2020-08-23 17:55:14 +02:00
Fabien Potencier
54eff0d96e
bug #3341 In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError (thijzert)
...
This PR was squashed before being merged into the 1.x branch.
Discussion
----------
In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
If a template accidentally performs `|filter(...)` on a variable that isn't traversable (e.g. `null`), the calling code will encouter the raw `TypeError` that results from Twig trying to construct an `IteratorIterator` on that variable. This means that context information (e.g., in which exact template the error occurred, and on which line) is discarded, which makes it very difficult to debug your templates.
This commit adds code to throw a `RuntimeError` if Twig encounters a situation where there's no valid way to filter an array.
Commits
-------
567b1e2a In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
2020-08-23 16:40:19 +02:00
Thijs van Dijk
567b1e2a06
In |filter(), |map(), and |reduce(), throw a RuntimeError instead of a TypeError
2020-08-23 16:40:13 +02:00
Fabien Potencier
bde54e11b8
Fix CS
2020-08-23 13:48:32 +02:00
Fabien Potencier
c38f96318b
Fix CS
2020-06-22 08:15:56 +02:00
Fabien Potencier
c829dafd75
Merge branch '1.x' into 2.x
...
* 1.x:
Update to PhpUnitBridge and fix deprecations
2019-08-08 10:19:01 +02:00
Jérémy Derussé
b776e41f5a
Update to PhpUnitBridge and fix deprecations
2019-08-08 09:39:49 +02:00
Fabien Potencier
1e3bb75010
moved test under tests/
2019-06-30 14:51:54 +02:00
Fabien Potencier
22a1317249
moved tests under tests/
2019-06-30 14:48:27 +02:00