Compatibility for Drupal 10

Created on 13 March 2023, over 1 year ago
Updated 22 September 2023, 9 months ago

Problem/Motivation

The regular Group module has support for Drupal 10, but the Subgroup module does not.

Here it would be good if we could enable support for Drupal 10 as well.

Most installations still run with version 1, an update to 2.x is often not possible, because in other group projects no update is available yet. So we will probably stay with Subgroup 1.x for a while, but at the moment it is not possible to update to Drupal 10.

The restriction in composer.json is actually done quickly and without problems, but update status still gives out the following things that should be fixed.

modules/contrib/subgroup/src/Event/GroupLeafEvent.php 13
Class Drupal\subgroup\Event\GroupLeafEvent extends deprecated class Symfony\Component\EventDispatcher\Event: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead

modules/contrib/subgroup/src/Event/GroupTypeLeafEvent.php 13
Class Drupal\subgroup\Event\GroupTypeLeafEvent extends deprecated class Symfony\Component\EventDispatcher\Event: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead

modules/contrib/subgroup/src/Form/SubgroupSettingsForm.php 262
Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

modules/contrib/subgroup/src/Form/SubgroupSettingsForm.php 569
Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

modules/contrib/subgroup/tests/src/Kernel/GroupViewTest.php 112
Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

modules/contrib/subgroup/subgroup.info.yml 0
Value of core_version_requirement: ^8.8 || ^9 is not compatible with the next major version of Drupal core. See https://drupal.org/node/3070687..

Steps to reproduce

Proposed resolution

* Provide patch or new release

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany zcht

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @zcht
  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India Ranjit1032002

    Created a Patch for the issue mentioned, please review.
    Thank you

  • Status changed to Needs work over 1 year ago
  • 🇩🇪Germany zcht

    the patch is not complete, see my description holistic.

  • 🇳🇱Netherlands Jan-E

    I totally agree with you that we should fix the D10 compatibility for Subgroup 1.x. Are you working on a patch?

  • 🇩🇪Germany zcht

    My dev skills are not that strong, I could try it. I'm just not sure with the stuff about entity queries if I would get it changed properly.

  • First commit to issue fork.
  • @shivam_tiwari opened merge request.
  • Status changed to Needs review about 1 year ago
  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    Subgroup 1 targets Group 1, which is not getting any more D10 love from my end, see #3278740-25: D10 compatibility . I would imagine treating Subgroup 1 the same way: If anyone provides patches that work well, I might commit them, but I'd need some +1s from people who can truly vouch the code looks good. #6 does not give me a lot of confidence in that regard :)

  • Status changed to Needs work about 1 year ago
  • 🇩🇪Germany zcht

    The MR for compatibility already goes in the right direction, however, this is buggy, at the moment in no case use in productive environment. The patch itself applied clean and everything works as it should, existing subgroups can be edited/updated/displayed. BUT: as soon as a new subgroup is created an extremely ugly error occurs. Subgroups are created, but not linked to the group, here the logic is completely broken. Thus linked node types cannot be inserted into the subgroup or other entities.

    On closer analysis I found that after the patch no relationships are created for subgroup_depth, subgroup_left, subgroup_right, subgroup_tree. The logic for this seems to be completely missing. On further analysis and testing, I also get error messages when new entities are added to the subgroup.

    My setup consists of Drupal 9.5.9, PHP 8.1, Group 1.5 and Subgroup 1.0.2

    The website encountered an unexpected error. Please try again later.
    Error: Undefined constant "Drupal\subgroup\Event\Symfony\Contracts\EventDispatcher\Event" in include() (line 6 of modules/contrib/subgroup/src/Event/GroupLeafEvent.php).
    include() (Line: 582)
    Composer\Autoload\{closure}('/var/www/html/docroot/modules/contrib/subgroup/src/Event/GroupLeafEvent.php') (Line: 433)
    Composer\Autoload\ClassLoader->loadClass('Drupal\subgroup\Event\GroupLeafEvent') (Line: 91)
    subgroup_group_update(Object)
    call_user_func_array(Object, Array) (Line: 426)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'subgroup') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('group_update', Object) (Line: 433)
    Drupal\Core\Extension\ModuleHandler->invokeAll('group_update', Array) (Line: 249)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 900)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 598)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
    Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
    Drupal\Core\Entity\EntityBase->save() (Line: 51)
    Drupal\subgroup\Entity\GroupSubgroupHandler->writeLeafData(Object, 1, 2, 3, 8610) (Line: 278)
    Drupal\subgroup\Entity\SubgroupHandlerBase->doAddLeaf(Object, Object) (Line: 103)
    Drupal\subgroup\Entity\GroupSubgroupHandler->doAddLeaf(Object, Object) (Line: 213)
    Drupal\subgroup\Entity\SubgroupHandlerBase->addLeaf(Object, Object) (Line: 240)
    subgroup_group_content_insert(Object)
    call_user_func_array(Object, Array) (Line: 426)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'subgroup') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('group_content_insert', Object) (Line: 433)
    Drupal\Core\Extension\ModuleHandler->invokeAll('group_content_insert', Array) (Line: 249)
    Drupal\Core\Entity\EntityStorageBase->invokeHook('insert', Object) (Line: 900)
    Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('insert', Object) (Line: 598)
    Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, ) (Line: 781)
    Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, ) (Line: 523)
    Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
    Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 157)
    Drupal\group\Entity\Group->addContent(Object, 'subgroup:MYSUBGROUPNAME', Array) (Line: 656)
    group_content_entity_submit(Array, Object)
    call_user_func_array('group_content_entity_submit', Array) (Line: 114)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm('group_MYSUBGROUPNAME_add_form', Array, Object) (Line: 325)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
    Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'add', Array) (Line: 368)
    Drupal\group\Entity\Controller\GroupContentController->createForm(Object, 'subgroup:MYSUBGROUPNAME')
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
    Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany zcht

    Have now created the first patch that works for me. No errors are thrown, subgroups can be edited and created. Fixed minor coding standards, set minimum group version to 1.5, declared Drupal 9.5 as minimum version. Tested under PHP 8.1, Drupal 9.5.9 & Drupal 10.x

    Feedback and testing would be appreciated.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update about 1 year ago
    PHPLint Failed
  • 🇩🇪Germany zcht

    Unfortunately, the patch with the adjustments for coding standards collides with the important patch # 3281672 🐛 doAddLeaf & doRemoveLeaf: timestamp bug and scalability Fixed

    The patch of @Jan-E I see as mandatory for the next release of Subgroup. So here is the minimum version for compatibility for Drupal 10.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    136 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    run-tests.sh fatal error
  • 🇳🇱Netherlands Jan-E

    I will take a look at it next week.

  • 🇳🇱Netherlands Jan-E

    Added related issue for the Group 8.x-1.x branch.

  • 🇩🇪Germany zcht

    Patch rerolled, on closer testing it was noticed that in the subgroup.module the statement for $event_dispatcher was in the wrong order and led to a fatal error under Drupal 10 when creating or updating a subgroup.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    133 pass, 1 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    run-tests.sh fatal error
  • 🇩🇪Germany zcht

    Also here, found some more. Existing accessCheck should NOT be changed, patch reroled.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    136 pass
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    run-tests.sh fatal error
  • 🇳🇱Netherlands Jan-E

    Group 8.x-1.6 added support for D10 now. How about Subgroup?

  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    I can see how much of the budget for the new Group release is left and perhaps use that here. Would need to find some time to figure that out.

  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    Removing credit from low-effort merge requests, adding updated tests and accessCheck(FALSE) on config entity queries.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update 9 months ago
    136 pass
  • 🇳🇱Netherlands Jan-E

    Thanks a lot! For a final Subgroup 1.x release the fix for doAddLeaf & doRemoveLeaf: timestamp bug and scalability 🐛 doAddLeaf & doRemoveLeaf: timestamp bug and scalability Fixed should be merged in the 1.0.x branch as well. You only merged that fix into the 2.0.x and 3.0.x branches as far as I know.

  • Status changed to Fixed 9 months ago
  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    I'm not too fond of being told what I should do as a maintainer. I've got some budget left so I'll see what I can do.

  • 🇳🇱Netherlands Jan-E

    Sorry. I should have asked you if that could be done as well. And it was a reminder to my self that that fix was not in the 1.0.x branch yet.

  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    Turns out this was also needed for v2 and v3, but because we didn't have D10 tests it never showed up.

  • 🇧🇪Belgium kristiaanvandeneynde Antwerp, Belgium

    Re #26 no worries and thanks for working on the other issue. It's just that as a maintainer you get a lot of people telling you what to do without helping out at all. You clearly do help out, so I appreciate the help and apologize if I came across a bit blunt.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024