[TwigComponent] Fix twig:blockquote is not a block - #3762
Open
smnandre wants to merge 1 commit into
Open
Conversation
kbond
approved these changes
Aug 10, 2026
Kocal
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A component whose name starts with
blockbreaks the block it sits in.Reproducer
The error points at
Card, which is correctly closed, and at the last line of thetemplate. Nothing mentions
blockquote, so there is little to go on.Same failure with
<twig:blockquote />,<twig:block-title />,<twig:blocked />, andinside a traditional
{% block %} … {% endblock %}.Not affected:
<twig:Blockquote />(the comparison is case-sensitive), and any of theseoutside a block.
Cause
TwigPreLexer::consumeUntilEndBlock()tracks block nesting with a fixed-length prefixcomparison:
'<twig:block'is also the first 11 characters of<twig:blockquote, so the depth isincremented for a component that is not a block. It is never decremented back: the
closing comparison is
'</twig:block>', which ends with>and therefore does notmatch
</twig:blockquote>. The enclosing<twig:block>never terminates, scanning runsto the end of the template, and the outer component is reported as unclosed.
Fix
Anchor the match and require that
blockis not followed by another component-namecharacter, using the same character class as
consumeComponentName():The closing comparison needs no change.