- Issue created by @project update bot
This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.
It is important that any automated tests available are run and that you manually test the changes.
Drupal 11 Compatibility
According to the Upgrade Status module β , even with these changes, this module is not yet compatible with Drupal 11.
Currently Drupal Rector, version 0.20.3, cannot fix all Drupal 11 compatibility problems.
Therefore, these changes did not update the
info.yml
file for Drupal 11 compatibility.The compatibility issues that Upgrade Status found after the Drupal Rector fixes were applied are attached to help you resolve them manually.
Leaving this issue open, even after committing the current patch or merging the MR, will allow the Project Update Bot β to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.
Debug information
Bot run #11-199781These packages were used to generate the fixes:
- drupal/upgrade_status: 4.3.2
- mglaman/phpstan-drupal: 1.2.11
- palantirnet/drupal-rector: 0.20.3
- π¦πΊAustralia VladimirAus Brisbane, Australia
vladimiraus β changed the visibility of the branch 3455312-automated-drupal-11 to hidden.
- π¦πΊAustralia VladimirAus Brisbane, Australia
vladimiraus β changed the visibility of the branch project-update-bot-only to hidden.
- Status changed to Needs work
7 months ago 1:27am 12 September 2024 - π¦πΊAustralia VladimirAus Brisbane, Australia
Thanks all. Need to fix
- phpstan
- upgrade status
- π¨π¦Canada joseph.olstad
joseph.olstad β made their first commit to this issueβs fork.
- π¨π¦Canada joseph.olstad
Ok, it's as far forward as I can take it, this is probably "good enough" to merge. If someone can improve this then great. I say merge it, and cut an alpha or beta or rc release so that we can avoid doing overrides in our composer for Drupal 11 compatibility.
There's a multitude of fixes here. I fixed:
- cspell
- stylelint
- many phpstan errors were fixed
- deprecation fixes in the automated tests
- deprecation fixes in the module code/classes.
Prior to these changes there was nothing but failures everywhere.
- π¦πΊAustralia VladimirAus Brisbane, Australia
Thanks for your contribution @joseph.olstad, but you cannot commit code and review it yourself.
Someone else need to review it and test it. - π¨π¦Canada joseph.olstad
I recommend merging this and cutting a 1.6.0-beta1 release so that we can scrap our composer overrides (please!).
All you have to do is merge and tag the 8.x-1.x as 1.6.0-beta1
This way 1.5 stays as the recommended release and we can work on improving 1.6.0 in Drupal 11 without resorting to painful composer overrides that complicate upgrades for those using our distribution of Drupal (WxT).
the drupal ci/cd does the rest.
- First commit to issue fork.
- π©πͺGermany jurgenhaas Gottmadingen
@joseph.olstad tests are almost green. There are just 2 phpunit tests that I don't know how to fix. There is 1 about a missing core service, that's confusing. And another 1 is about regex and I don't think we've changed anything there and this must have failed already before.
Could you probably have a look into that? Everything else is resolved.
- π¨π¦Canada joseph.olstad
Yes the missing core service is confusing. And for the regex, these tests were extremely broken prior to this merge request and they have deleted the historical jenkins results so I don't know when this was last working (if ever). This merge request is a vast improvement. With that said, we'll continue to use this merge request and review the results manually. Merging this would be good if we could merge and tag an alpha or beta or rc release for D11 that'd be a step in the right direction.
- π¨π¦Canada smulvih2 Canada π
I'm testing this on core 11.1.1, using toc_api from this MR, along with toc_filter 2.3.0. I'm running into an error when saving a node that is using the [toc] token, assume the error is coming from toc_api:
TypeError: Drupal\Core\Render\MetadataBubblingUrlGenerator::generateFromRoute(): Argument #2 ($parameters) must be of type array, null given, called in /var/www/html/core/lib/Drupal/Core/Url.php on line 769 in Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute() (line 104 of core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php).
Drupal\Core\Url->toString(1) (Line: 175)
Drupal\Core\Utility\LinkGenerator->generate(Object, Object) (Line: 102)
Drupal\Core\Render\Element\Link::preRenderLink(Array)
call_user_func_array(Array, Array) (Line: 107)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 β ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 825)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 387)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 203)
Drupal\Core\Render\Renderer->render(Array) (Line: 484)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 120)
__TwigTemplate_e9204f7060e2bc684929174b8b8efc1d->{closure}() (Line: 2058)
Twig\Extension\CoreExtension::captureOutput(Object) (Line: 88)
__TwigTemplate_e9204f7060e2bc684929174b8b8efc1d->macro_tree_links(Array) (Line: 67)
__TwigTemplate_e9204f7060e2bc684929174b8b8efc1d->doDisplay(Array, Array) (Line: 387)
Twig\Template->yield(Array, Array) (Line: 343)
Twig\Template->display(Array) (Line: 358)
Twig\Template->render(Array) (Line: 35)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('modules/contrib/toc_api/templates/toc-tree.html.twig', Array) (Line: 354)
Drupal\Core\Theme\ThemeManager->render('toc_tree', Array) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 203)
Drupal\Core\Render\Renderer->render(Array) (Line: 484)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 51)
__TwigTemplate_2dc37c9b3f055a0c562225983c06be41->doDisplay(Array, Array) (Line: 387)
Twig\Template->yield(Array, Array) (Line: 343)
Twig\Template->display(Array) (Line: 358)
Twig\Template->render(Array) (Line: 35)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('modules/contrib/toc_api/templates/toc-default.html.twig', Array) (Line: 354)
Drupal\Core\Theme\ThemeManager->render('toc_default', Array) (Line: 446)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 203)
Drupal\Core\Render\Renderer->render(Array) (Line: 157)
Drupal\toc_api\TocBuilder->renderToc(Object) (Line: 184)
Drupal\toc_filter\Plugin\Filter\TocFilter->process - π¨π¦Canada joseph.olstad
Hmm,
Seems there's smoke in the twig files?templates/toc-tree.html.twig
and
templates/toc-default.html.twig
and this
#pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 β ',
- π©πͺGermany jurgenhaas Gottmadingen
I'm not deep into twig, so this is certainly a task for someone else.
- π¨π¦Canada joseph.olstad
ok @jurgenhaas, I'll have to go through the test scenarios manually in my environment. Hopefully some time this week or next week!
Thanks for your work on this!
- π¦πΊAustralia VladimirAus Brisbane, Australia
Seems like an issue was fixed in π TypeError: ..\MetadataBubblingUrlGenerator::generateFromRoute(): Argument #2 ($parameters) must be of type array Active .
Can you have a look? - π¨π¦Canada Liam Morland Ontario, CA π¨π¦
Re "these tests were extremely broken prior to this merge request": The current merge request adds the
.gitlab-ci.yml
file. I suggest committing π Add testing configuration Active . This adds.gitlab-ci.yml
and gets the tests passing. Use that issue to get tests passing and then ensure that they keep passing in the current issue. - π¦πΊAustralia VladimirAus Brisbane, Australia
Need work based on CI.
- First commit to issue fork.
- π¨π¦Canada danrod Ottawa
I am looking at the PHPSTAN issues, is the
disabledTestRender()
really needed?tests/src/Kernel/TocManagerTest.php
/** * Tests TOC rendering. Temporarily disabled. * * @return bool|string * This return a string or a boolean value. */ public function disabledTestRender() { /** @var \Drupal\Core\Render\RendererInterface $renderer */ $renderer = \Drupal::service('renderer'); /** @var \Drupal\toc_api\TocManager $toc_manager */ $toc_manager = \Drupal::service('toc_api.manager'); /** @var \Drupal\toc_api\TocBuilder $toc_builder */ $toc_builder = \Drupal::service('toc_api.builder');
- π¨π¦Canada danrod Ottawa
I fixed all of the PHPSTAN / PHPCS issues that were popping up in the tests/ directory, I ran the tests and they all passed now, I'm not familiar with ths module so I'll need to check if I broke other components of the module by fixing this:
daniel@drupal:/var/www/html$ ./vendor/bin/phpunit web/modules/contrib/toc_api/tests/ --verbose -c web/core/phpunit.xml PHPUnit 10.5.45 by Sebastian Bergmann and contributors. Unknown option "--verbose" daniel@drupal:/var/www/html$ ./vendor/bin/phpunit web/modules/contrib/toc_api/tests/ -c web/core/phpunit.xml HTML output directory sites/simpletest/browser_output is not a writable directory. PHPUnit 10.5.45 by Sebastian Bergmann and contributors. Runtime: PHP 8.3.14 Configuration: /var/www/html/web/core/phpunit.xml ................................. 33 / 33 (100%) Time: 00:02.034, Memory: 6.00 MB OK (33 tests, 178 assertions) daniel@drupal:/var/www/html$
I aware that they are other issues other than the CI messages and the tesd directory, for now I am moving this to "Needs Review"
- π¨π¦Canada joseph.olstad
@danrod, great work, fixing the phpstan issues appears to have also fixed the automated tests. 33 tests pass.
- Status changed to Needs review
24 days ago 5:57am 10 March 2025 - π¦πΊAustralia dabbor
Hi everyone and thank you for your effort.
I'm trying to use patch from the MR: https://git.drupalcode.org/project/toc_api/-/merge_requests/16 but for some reason not having luck, getting conflicts (can not be applied).
I tried the following branches as base:
- 8.x-1.7 (meaning8.x-1.x
branch with tag8.x-1.7
)
- 2.0.x-dev#89c0b377 using the latest commit hash (meaning2.0.x
branch with commit hash89c0b377
). This seems to be having the same tag8.x-1.7
as the8.x-1.x
branch has (which is confusing).I git-cloned the MR branch and made the patch manually from branch
3455312-drupal11-fixes
against branch8.x-1.x
as base. The2.0.x
branch does not exists in the MR request issue repository (not being up to date with the original).
- The patch did not work and I got conflicts to resolve.
- I can see that the MR started on version 1.5 or so and then the conflicts were resolved (merged back) for: 1.6 and 1.7. But maybe something went wrong with the merge conflicts resolutions, I do know exactly.I appreciate any advice on getting this MR into patch that I can apply to toc_api contrib.
- π¨π¦Canada joseph.olstad
@dabbor , sometimes you'll get better results using the diff instead of the patch, especially if you're doing a
--dry-run
test of it.https://git.drupalcode.org/project/toc_api/-/merge_requests/16.diff
- π¦πΊAustralia dabbor
Hi @joseph.olstad,
Thank you very much for your advice, I'm happy to learn something new :)
I believe I understood the difference. The patch includes history of the commits and its application tries to do something like git merge while the diff provides just the differences which can be applied without any knowledge of commits or processes that led to the point.
The https://git.drupalcode.org/project/toc_api/-/merge_requests/16.diff works for me, so I'm adding a static patch file from it for referencing in composer (to have a static input that is not changing with the MR updates).
- π¦πΊAustralia dabbor
It seems that while saving the https://git.drupalcode.org/project/toc_api/-/merge_requests/16.diff as a static patch I made a mistake copy pasting it into the file instead of savign the https://git.drupalcode.org/project/toc_api/-/merge_requests/16.diff from browser and as such I misses some character encoding or so making the previous patch not working so I'm replacing it now.
- π¨π¦Canada smulvih2 Canada π
Ok all tests are now passing, functionally toc_api works as expected from my testing. This is ready for review and a new tagged release!
- π¨π¦Canada danrod Ottawa
Yes !
Is there any chance to reach out to the maintainers for a tagged release?