Fabien Potencier
b86fd0a059
Remove obsolete files
2025-02-26 22:13:11 +01:00
Fabien Potencier
56204e951a
Move some tests
2025-02-26 22:10:10 +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
7cde13f6c9
bug #4595 Improve error reporting (fabpot)
...
This PR was merged into the 3.x branch.
Discussion
----------
Improve error reporting
Commits
-------
d5dc3eee99 Improve error reporting
2025-02-22 18:27:58 +01:00
Fabien Potencier
d5dc3eee99
Improve error reporting
2025-02-22 10:22:21 +01:00
Fabien Potencier
d7702840da
Remove $templateName from Template::loadTemplate()
2025-02-21 23:48:41 +01:00
Fabien Potencier
d72c1c6b1e
Fix testing and expression when it evaluates to an instance of Markup
2025-02-21 18:29:32 +01:00
Fabien Potencier
2d84abfd08
Make the defined test implementation more generic
2025-02-21 08:36:21 +01:00
Fabien Potencier
151aa4ecda
Fix CS
2025-02-14 12:57:03 +01:00
Fabien Potencier
3964aeba78
Add a proper prefix spread operator
2025-02-14 11:45:39 +01:00
Fabien Potencier
79d828b09d
Fix version
2025-02-14 08:47:54 +01:00
Fabien Potencier
251c0b5da9
Fix CS
2025-02-14 08:45:28 +01:00
Fabien Potencier
4b57f48a65
Use generics in ExpressionParsers
2025-02-14 08:38:53 +01:00
Fabien Potencier
8ff19090f3
Fix precedence rules
2025-02-14 08:38:53 +01:00
Fabien Potencier
f67078b5c4
Move Operators to ExpressionParsers, deprecate ExpressionParser
2025-02-14 08:38:53 +01:00
Fabien Potencier
42c82e1e9b
Extract operators logic from ExpressionParser to their own classes
2025-02-14 08:38:53 +01:00
Fabien Potencier
df877a1d53
Introduce operator classes to describe operators provided by extensions instead of arrays
2025-02-14 08:38:53 +01:00
Christophe Coevoet
3794efe662
Fix support for ignoring syntax erros in an undefined handler in guard
2025-02-09 15:10:34 +01:00
Fabien Potencier
fab1a37d8e
bug #4546 Fix timezone conversion on strings (PrinsFrank)
...
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Fix timezone conversion on strings
When setting a default application timezone, and a display timezone:
```php
date_default_timezone_set('UTC');
$twig->getExtension(\Twig\Extension\CoreExtension::class)->setTimezone('Europe/Paris');
```
Date objects get converted, but strings don't. See #4545 .
For most other paths in `convertDate`, the dateTime object is initialized, and afterwards the timezone gets set. For strings, the timezone is passed as a constructor argument before having the timezone set again, losing its converting behaviour. This makes the convertDate method work identical for DateTime objects as strings. This different behaviour was already spotted in #3568 .
Fixes #4545 #3568 #2819
Commits
-------
f69531fa00 Fix timezone conversion on strings
2025-02-07 22:52:13 +01:00
PrinsFrank
f69531fa00
Fix timezone conversion on strings
2025-02-07 22:52:10 +01:00
Fabien Potencier
7f080086dc
Fix wrong array index
2025-02-01 16:22:20 +01:00
Fabien Potencier
b0399992be
Fix wrong array index
2025-02-01 10:33:30 +01:00
Fabien Potencier
e48abfe47c
Add even more tests
2025-01-31 19:03:58 +01:00
Fabien Potencier
3b605c4180
Add some tests on balanced brackets
2025-01-30 13:38:40 +01:00
Fabien Potencier
445f74cfe0
[SECURITY] Fix a security issue where escaping was missing when using ??
2025-01-29 07:52:07 +01:00
Fabien Potencier
ade8bce516
Deprecate Token::getType()
2025-01-24 15:48:04 +01:00
Fabien Potencier
609767522a
Add ForElseNode
2025-01-24 15:25:30 +01:00
Nicolas Grekas
1d5180549f
Ignore static properties when using the dot operator
2025-01-22 09:18:31 +01:00
Fabien Potencier
76062c8d51
Fix CS
2025-01-19 16:54:05 +01:00
Fabien Potencier
a998723b70
Fix constant() behavior when used with ??
2025-01-14 17:55:21 +01:00
Lorenz
8b432758f6
invoke filter
2025-01-12 18:44:45 +01:00
Fabien Potencier
dff6fdd675
Make {} optional for the types tag
2025-01-06 13:53:28 +01:00
Jérôme Tamarelle
d8fe3bd1ec
Add LastModifiedExtensionInterface and implementation in AbstractExtension to track modification of runtime classes
2025-01-02 14:50:18 +01:00
Fabien Potencier
efd12ef0cc
Optimize NameExpression compilation
2025-01-02 12:32:36 +01:00
Fabien Potencier
2cf1939d01
Fix unary operator precedence change
2024-12-28 11:29:38 +01:00
Fabien Potencier
b53c639f7d
Ignore exceptions from undefined handlers when using the guard tag
2024-12-19 15:10:50 +01:00
Faizan Akram
0a61801d9a
adds support for invoking closures
2024-12-14 20:06:34 +01:00
Fabien Potencier
4c5467f56a
Fix the null coalescing operator when the test returns null
2024-12-12 10:17:22 +01:00
Fabien Potencier
1af334be89
Fix the Elvis operator when there is some space between ? and :
2024-12-11 10:38:21 +01:00
Gregor Harlan
32a75b7869
Fix ArrayAccess with objects as keys
2024-12-05 12:31:45 +01:00
Fabien Potencier
d894f92d12
feature #4487 Support underscores in number literals (smnandre)
...
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
Support underscores in number literals
```twig
{{ 1000 == 1_000 ? 'yes' : 'no' }}
# now: syntax error
# this PR: "yes"
```
> As of PHP 7.4.0, integer literals may contain underscores (_) between digits, for better readability of literals. These underscores are removed by PHP's scanner.
https://www.php.net/manual/en/language.types.integer.php
This PR replicates that behaviour, using the regexp to match the literals and then remove the "_".
I'm targeting **Twig4** but maybe 3.x would be ok?
I cannot think of a real case that
- does not trigger an error currently
- would work differently after this PR
Commits
-------
da4d96692a Support underscores in number literals
2024-12-02 09:47:00 +01:00
Simon André
da4d96692a
Support underscores in number literals
2024-12-02 09:46:54 +01:00
Fabien Potencier
14fc89ebea
Fix CS
2024-11-30 09:42:13 +01:00
Fabien Potencier
44516133e2
Fix CS
2024-11-30 09:33:57 +01:00
Fabien Potencier
4f8ba93600
Enforce AbstractBinary for all binary operators
2024-11-29 16:51:09 +01:00
Fabien Potencier
bdb0f3c042
Fix having macro variables starting with an underscore
2024-11-26 16:59:45 +01:00
Fabien Potencier
e7e72ff090
Deprecate not passing a Source to TokenStream
2024-11-24 19:41:42 +01:00
Fabien Potencier
c5d0d593d2
minor #4446 Improve YieldReady support docs (fabpot)
...
This PR was merged into the 3.x branch.
Discussion
----------
Improve YieldReady support docs
Refs https://github.com/twigphp/Twig/discussions/4428
Commits
-------
9d9c9d81e9 Improve YieldReady support docs
2024-11-12 08:12:30 +01:00
Fabien Potencier
9d9c9d81e9
Improve YieldReady support docs
2024-11-11 09:38:36 +01:00