Skip to content
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

Fix compatibility with twig 3.9 and yielding #344

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

jderusse
Copy link
Contributor

This PR makes CSPNode compatible with twig 3.9.

Since twigphp/Twig#3999 we cannot use ob_ method to get the generated output (See twigphp/Twig#4034)

This PR fixes the issue by using the CaptureNode introduced in twigphp/Twig#3954

Fix #343

src/Twig/Node/CSPNode.php Outdated Show resolved Hide resolved
@franmomu franmomu merged commit 4babd57 into nelmio:master Jun 2, 2024
@franmomu
Copy link
Collaborator

franmomu commented Jun 2, 2024

thanks @jderusse!

@jderusse jderusse deleted the yield-compat branch June 3, 2024 06:45
->subcompile($body)
->write($output)
;
$compiler->write("echo \$content;\n");
Copy link
Member

Choose a reason for hiding this comment

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

I still get deprecation warnings in the test suite which I think are coming from this line?

4x: Since twig/twig 3.9: Using "echo" is deprecated, use "yield" instead in "Nelmio\SecurityBundle\Twig\Node\CSPNode", then flag the class with #[YieldReady].
2x in IntegrationTest::testItWorksDynamically from Nelmio\SecurityBundle\Tests\Twig
2x in IntegrationTest::testItWorksStatically from Nelmio\SecurityBundle\Tests\Twig

Should this not be a yield?

Copy link
Contributor Author

@jderusse jderusse Jul 1, 2024

Choose a reason for hiding this comment

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

indeed :(

fixed in #353

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibility with twig 3.9
4 participants