Skip to content

[TwigBridge] ensure compatibility with Twig 3.15 #58649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Oct 23, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

take the changes from twigphp/Twig#4398 into account

@carsonbot carsonbot added this to the 5.4 milestone Oct 23, 2024
@xabbuh xabbuh changed the title [TwigBridge] fix test compatibility with Twig 3.15 [TwigBridge] ensure compatibility with Twig 3.15 Oct 23, 2024
@xabbuh xabbuh force-pushed the twig-4398 branch 2 times, most recently from dd8f24f to a2decdb Compare October 24, 2024 06:27
@xabbuh xabbuh requested a review from fabpot October 24, 2024 06:33
@@ -51,8 +53,8 @@ public function enterNode(Node $node, Environment $env): Node
return $node;
} else {
$var = $this->getVarName();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered that this node visitor breaks reproducible compilation here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, let's fix this explicitly in a separate PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that this was fixed for 7.2 in #57609. Should we backport that PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that PR is actually broken

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's backport (and fix the broken part) in 5.4 yes
reproducible builds FTW

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A way to generate a reproducible name that does not clash with parent or child template could be to use a hash of the template name in the variable name (with the new hardcoded name as prefix)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #58706

@xabbuh xabbuh force-pushed the twig-4398 branch 2 times, most recently from 54684fa to fd70afd Compare October 24, 2024 11:30
@xabbuh
Copy link
Member Author

xabbuh commented Oct 24, 2024

I updated the DumpNode class to also accept a LocalVariable instance.

Though I am stuck at how we can deal with a similar case in the StopwatchNode. Any idea how to handle it?

@xabbuh
Copy link
Member Author

xabbuh commented Oct 24, 2024

I think I got a solution for the StopwatchNode as well.

Status: Needs Review

@nicolas-grekas
Copy link
Member

Thank you @xabbuh.

@nicolas-grekas nicolas-grekas merged commit c05fed1 into symfony:5.4 Oct 25, 2024
10 of 12 checks passed
@xabbuh xabbuh deleted the twig-4398 branch October 25, 2024 15:20
This was referenced Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants