pimcore / pimcore

Core Framework for the Open Source Data & Experience Management Platform (PIM, MDM, CDP, DAM, DXP/CMS & Digital Commerce)
http://www.pimcore.com
Other
3.24k stars 1.41k forks source link

"pimcore_placeholder()" Twig function is broken by "twig/twig" >= v3.9.0 #16973

Open alesak opened 2 months ago

alesak commented 2 months ago

Pimcore version

10.6 or newer

Steps to reproduce

try to render attached twig document placeholder-test.html.twig.txt

Actual Behavior

When rendered with twig v3.8.0 it correctly renders three times same section but when rendered with twig v3.9.0 or newer the part which should be captured is actually rendered and the three sections which should contain captured content are empty

Expected Behavior

same content should be rendered with both versions of "twig/twig"

jdreesen commented 2 months ago

That's because it uses rybakit/twig-deferred-extension, which hacks Twig to do its thing, and now it broke with the latest Twig update.

So you should stay on Twig <3.9 for now, like: #16958

alesak commented 2 months ago

I don't think it uses rybakit/twig-deferred-extension but rather similar technique using \ob_start() \ob_get_clean(); to capture the content and is now not working thanks to the "yield" output used in twig >= 3.9.0 instead print or echo....

jdreesen commented 2 months ago

You're right. This needs to be fixed on Pimcore's side. Maybe the new CaptureNode helps here.