Commit Graph

669 Commits

Author SHA1 Message Date
Nicolas Grekas ef3780c2e0 Speed up loading compiled templates that OPcache already holds 2026-09-30 22:20:34 +02:00
Nicolas Grekas 69fefec125 Speed up traversing nodes with node visitors 2026-09-30 22:13:07 +02:00
Nicolas Grekas 9e1e2e2cea Allow skipping the directory check when adding paths to FilesystemLoader 2026-09-30 21:16:25 +02:00
Fabien Potencier c6f1ef9521 Fix the deprecated tag generating invalid PHP for an integer message 2026-09-28 12:38:11 +02:00
Fabien Potencier d79ac7e60d bug #4974 Fix the loop variable of a for tag being undefined in the sequence of a nested loop (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix the loop variable of a for tag being undefined in the sequence of a nested loop

Commits
-------

0c90971a98 Fix the loop variable of a for tag being undefined in the sequence of a nested loop
2026-09-28 12:26:36 +02:00
Fabien Potencier a04ae6d636 Reject the spread operator outside sequences, mappings, and call arguments 2026-09-27 19:43:42 +02:00
Fabien Potencier 0c90971a98 Fix the loop variable of a for tag being undefined in the sequence of a nested loop 2026-09-26 10:54:52 +02:00
Fabien Potencier d5011f4654 Discard what the non-selected branch of a guard tag registers on the parser 2026-09-26 10:43:21 +02:00
Fabien Potencier 39642e4cdf Reset the escaping state when compiling a new template after a compilation error 2026-09-26 10:41:54 +02:00
Fabien Potencier 6ec06d1883 bug #4959 Reject a Template instance created by another environment when resolving templates (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Reject a Template instance created by another environment when resolving templates

Commits
-------

605b1278f7 Reject a Template instance created by another environment when resolving templates
2026-09-26 10:38:49 +02:00
Fabien Potencier b1d6b51183 Fix the sandbox not reporting the line of a rejected guard tag 2026-09-26 10:22:21 +02:00
Fabien Potencier 605b1278f7 Reject a Template instance created by another environment when resolving templates 2026-09-25 23:34:59 +02:00
Fabien Potencier ddd9045b5c Skip the property checker call and memoize the class constant probe when reading an object attribute 2026-09-25 16:00:51 +02:00
Fabien Potencier 3417f483bf Fetch the escaper runtime once in the constructor of templates that escape 2026-09-25 12:44:56 +02:00
Fabien Potencier 00861d50ab Fix split trailing newline 2026-09-25 12:39:38 +02:00
Fabien Potencier c8d782ea0b Deprecate calling TemplateWrapper::unwrap() without arguments as of 3.30 and list the fix in the CHANGELOG 2026-09-25 07:44:32 +02:00
Fabien Potencier 9c3d58e638 Fix coding standards 2026-09-25 07:44:12 +02:00
Nicolas Grekas d3d13f9b1a Speed up adding extensions to an environment 2026-09-24 18:47:14 +02:00
Fabien Potencier 4d5d233776 Compile the generator guard as an unreachable yield instead of a yield from 2026-09-22 22:00:07 +01:00
Fabien Potencier 6f94a47ce1 Reuse the template wrapper of an already loaded template 2026-09-22 21:02:38 +01:00
Fabien Potencier ff4a1c6575 bug #4937 Stop the escaping safe analysis from retaining every analyzed node (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Stop the escaping safe analysis from retaining every analyzed node

Commits
-------

8274571d04 Stop the escaping safe analysis from retaining every analyzed node
2026-09-22 20:42:55 +01:00
Fabien Potencier 8274571d04 Stop the escaping safe analysis from retaining every analyzed node 2026-09-22 16:47:34 +01:00
Alexander M. Turek bfbe89e3a3 Allow to call TemplateWrapper::unwrap() without arguments 2026-09-22 09:22:57 +02:00
Fabien Potencier 26812ebc0d Expose the escaping strategy a template was compiled with 2026-09-21 11:30:11 +01:00
Fabien Potencier a8ee6dd762 Improve macro call performance 2026-09-20 21:28:03 +01:00
Fabien Potencier d722e8af93 bug #4931 Fix array access with a Stringable key on subclasses of ArrayObject and ArrayIterator (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Fix array access with a Stringable key on subclasses of ArrayObject and ArrayIterator

Commits
-------

4aae99e92c Fix array access with a Stringable key on subclasses of ArrayObject and ArrayIterator
2026-09-20 20:17:49 +01:00
Fabien Potencier 4aae99e92c Fix array access with a Stringable key on subclasses of ArrayObject and ArrayIterator 2026-09-20 20:17:42 +01:00
Fabien Potencier 1ee9dae55a Cover and document the matches operator throwing on an invalid UTF-8 subject 2026-09-18 17:15:53 +01:00
Fabien Potencier 5c1be030c5 Report a clear error when a string cannot be split into characters 2026-09-18 17:15:50 +01:00
Fabien Potencier 55afb2e084 Deprecate cloning a Twig environment 2026-09-18 16:52:58 +01:00
Fabien Potencier 40d57c6445 Report the macro call parentheses deprecation once per call site and name the macro 2026-09-18 12:17:08 +02:00
Fabien Potencier dea0483027 feature #4910 Reject template wrappers from another environment (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Reject template wrappers from another environment

Twig now rejects `TemplateWrapper` instances created by another `Environment`.

This prevents templates from unexpectedly using another environment's loader, extensions, globals, or sandbox policy.

Commits
-------

83e8f7e123 Reject cross-environment template wrappers in block chains
c1fc112047 Reject cross-environment template wrappers
2026-09-14 14:11:48 +02:00
Fabien Potencier 0f5c902d85 bug #4927 Report a clear error when using macros imported in a template body that was not rendered (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Report a clear error when using macros imported in a template body that was not rendered

Commits
-------

72c2f669bd Report a clear error when using macros imported in a template body that was not rendered
2026-09-14 14:05:45 +02:00
Fabien Potencier 56e5c0794b Clarify the exception message for nested block chains from another environment 2026-09-14 11:59:20 +02:00
Fabien Potencier d6b81f9074 Allow block chains to be composed of other block chains 2026-09-14 11:17:44 +02:00
Fabien Potencier 72c2f669bd Report a clear error when using macros imported in a template body that was not rendered 2026-09-12 12:17:17 +02:00
Fabien Potencier 83e8f7e123 Reject cross-environment template wrappers in block chains 2026-09-12 09:57:01 +02:00
Fabien Potencier c1fc112047 Reject cross-environment template wrappers 2026-09-12 09:51:36 +02:00
Fabien Potencier 897717d78f Resolve block chains against the render context instead of freezing lineages 2026-09-12 00:03:19 +02:00
Fabien Potencier c53b6468c9 Resolve constant parent templates once instead of on every lookup 2026-09-11 06:17:05 -07:00
Fabien Potencier 49f814ea26 Template runtime and block composition 2026-09-11 04:57:38 -07:00
Fabien Potencier 7b19e1561b bug #4918 Check that the use tag is allowed before resolving trait templates (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Check that the use tag is allowed before resolving trait templates

Commits
-------

18863f0371 Check that the use tag is allowed before resolving trait templates
2026-09-07 19:06:37 +02:00
Fabien Potencier b6da5e67f3 Wrap dynamic parent expression errors 2026-09-07 15:08:50 +02:00
Fabien Potencier 0e1852632f Fix TemplateWrapper::hasBlock() and TemplateWrapper::getBlockNames() omitting environment globals 2026-09-07 14:15:32 +02:00
Fabien Potencier 18863f0371 Check that the use tag is allowed before resolving trait templates 2026-09-07 09:29:38 +02:00
Fabien Potencier 2d0c30b075 Remove redundant default filter cases 2026-09-03 08:49:11 +02:00
Fabien Potencier 0b4199c522 Strengthen the default filter regression test 2026-09-03 08:32:22 +02:00
Lazizbek Ergashev 86c830ef45 Fix the default filter fallback reusing a null-safe temporary variable 2026-09-01 16:06:07 +05:00
Fabien Potencier c32656815b minor #4908 Remove the documentation comments compilation overhead (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Remove the documentation comments compilation overhead

Documentation comments are now attached to semantic nodes during parsing, removing the dedicated AST traversal. Token parsers returning placeholder nodes can select the semantic documentation target.

Commits
-------

60eed4ccd5 Remove the documentation comments compilation overhead
2026-08-29 00:19:33 +02:00
Fabien Potencier 60eed4ccd5 Remove the documentation comments compilation overhead 2026-08-29 00:19:29 +02:00