- Issue created by @longwave
- First commit to issue fork.
- ๐ท๐ธSerbia finnsky
finnsky โ changed the visibility of the branch 3473440-fix-twig-3 to hidden.
- Status changed to Needs work
about 2 months ago 1:32am 20 September 2024 - Status changed to Needs review
about 2 months ago 8:18am 20 September 2024 - ๐ท๐ธSerbia finnsky
Spaceless. Seems easier one from this bundle rewritten
We can remove it without any problems and get better perfomance
https://github.com/twigphp/Twig/pull/4236
https://github.com/twigphp/Twig/pull/4308Probably every deprecation thing requires own subticket. Not sure. I gonna continue here to have full picture.
Sending for review to understand if approach is correct. - ๐ท๐ธSerbia finnsky
So we have 4(5) types of deprecations
1. "Not passing an instance of "TwigFunction" when creating a "XXX" function"
Fixed here in the test-passing-function branch. Can be moved to a separate task.
2. "The "tag" constructor argument"
Also fixed here.
3. "spaceless is deprecated"
Fixed for tests here. Also fixed tests.
4 and 5 are related to modifications of the default escape filter using drupal_escape
https://twig.symfony.com/doc/3.x/filters/escape.html#custom-escapers
it says here that
"Built-in escapers cannot be overridden mainly because they should be considered as the final implementation and also for better performance."The last point definitely deserves a separate task. All the rest can be merged here or in their subtasks
- ๐ณ๐ฑNetherlands bbrala Netherlands
Just so you know.
This complely broke upgrade status and the update bot. Since we now ship deprecations with core. The d11 readiness dashboard showed like +200k errors suddenly and we eventually tracked it back here.
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
Should ๐ Fix "Twig\Node\Expression\FilterExpression" deprecation introduced in twig/twig 3.12.0 Active be directly solved in this issue or remain in its own?
- ๐ท๐ธSerbia finnsky
@gรกbor hojtsy
It's hard to say now. In the current task (which should later become meta) I consider all deprecations at once and globally. Several are already ready to receive their subtask and be merged.
As for the task that you linked, I think it has the wrong name. We can't just rewrite the functions there. But consider how drupal_escape and trans work in general. And add it as required by the modern version of Twig. This is currently in progress.
- ๐ฌ๐งUnited Kingdom longwave UK
There are four child issues now, one with its own MR, the three MRs from here need moving to their individual issues - but I think that covers all the newly added deprecations.
- ๐ท๐ธSerbia finnsky
I would say 5 issues but not sure yet ;) As i said better to review also how `trans` and `drupal_escape` works
- ๐ฌ๐งUnited Kingdom longwave UK
@finnsky ๐ Fix "Twig\Node\Expression\FilterExpression" deprecation introduced in twig/twig 3.12.0 Active is RTBC and should fix both drupal_escape and trans.
- ๐ท๐ธSerbia finnsky
Imo we shouldn't just `fix deprecation message` here. But fix deprecations deeper, with research of new twig extending style. This issue is RTBC of course. But - can we do it better? Idk yet.
- ๐ท๐ธSerbia finnsky
finnsky โ changed the visibility of the branch 3473440-twig-deprecations to hidden.
- ๐ท๐ธSerbia finnsky
finnsky โ changed the visibility of the branch test-pasing-function to hidden.
- ๐ท๐ธSerbia finnsky
finnsky โ changed the visibility of the branch test-tag-constructor-argument to hidden.
- ๐ณ๐ฑNetherlands bbrala Netherlands
While reviewing the child issues i concluded we might need a change record here (or on the twig update issue?).
Contrib will want to know how to fix these errors, having a guideline on where to find the core fixes will help a lot.
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
Imo we shouldn't just `fix deprecation message` here. But fix deprecations deeper, with research of new twig extending style. This issue is RTBC of course. But - can we do it better? Idk yet.
I think it would be great to have a "good enough" solution ASAP, and then spend any time to fix it even better later. Because these deprecated API uses produce errors with most runs of Upgrade Status on all contrib projects and people can't do anything about it. When we ran Project Status on all contrib modules, these produced 190 thousand twig deprecacted API calls detected across all of Drupal 10 contrib :) This also means that none of those are getting project update bot patches/MRs because they have these unsolvable issues. So a quick solution would be important to unblock the rest of the ecosystem / tooling, then a better solution is not out of question :)
- ๐ญ๐บHungary Gรกbor Hojtsy Hungary
These were the top errors found in contrib by Project Analysis:
- 177 765 times (in 1324 projects):
Since twig/twig 3.12: Getting node "filter" on a "Twig\Node\Expression\FilterExpression" class is deprecated.
- 10734 times (in 641 projects):
Since twig/twig 3.12: Not passing an instance of "TwigFunction" when creating a "render_var" function of type "Twig\Node\Expression\FunctionExpression" is deprecated.
- 1080 times (in 209 projects):
Since twig/twig 3.12: The "tag" constructor argument of the "Drupal\Core\Template\TwigNodeTrans" class is deprecated and ignored (check which TokenParser class set it to "trans"), the tag is now automatically set by the Parser when needed.
- 1100 times (in 274 projects):
Since twig/twig 3.12: Getting node "filter" on a "Twig\Node\Expression\Filter\RawFilter" class is deprecated.
- 864 times (in 121 projects):
Since twig/twig 3.12: Getting node "filter" on a "Twig\Node\Expression\Filter\DefaultFilter" class is deprecated.
- 512 times (in 147 projects):
Since twig/twig 3.12: Twig Filter "spaceless" is deprecated. See https://drupal.org/node/3071078.
Are these all being resolved in the children? :)
Also these two were found in one project each, not a priority IMHO:
Since twig/twig 3.12: Character """ at position 2 should not be escaped; the "\ character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character."
in formatage_models 4.x-devSince twig/twig 3.12: Character "T" at position 7 should not be escaped; the "\ character is ignored in Twig v3 but will not be in v4. Please remove the extra "\" character."
in festeva 1.0.x-dev
- 177 765 times (in 1324 projects):
- ๐ณ๐ฑNetherlands bbrala Netherlands
Yeah all being handled in the children.
- ๐ท๐ธSerbia finnsky
yep. now all deprecations covered
not sure is this"good enough" solution ASAP
but at least
solution ASAP
:)
- ๐ณ๐ฑNetherlands bbrala Netherlands
Only the spaceless deprecation fix needs work, 2 are merged, 1 is RTBC. Almost there ^^