Entity clone invokes any entity type's createAccess() without knowing about required context values

Created on 1 December 2022, over 1 year ago
Updated 31 May 2023, about 1 year ago

Problem/Motivation

Get a WSOD error when removing member from group

TypeError: Drupal\group\Plugin\Group\RelationHandler\GroupMembershipAccessControl::relationshipCreateAccess(): Argument #1 ($group) must be of type Drupal\group\Entity\GroupInterface, null given, called in /mnt/www/html/llnl8/docroot/modules/contrib/group/src/Entity/Access/GroupRelationshipAccessControlHandler.php on line 61 in Drupal\group\Plugin\Group\RelationHandler\GroupMembershipAccessControl->relationshipCreateAccess() (line 90 of /mnt/www/html/llnl8/docroot/modules/contrib/group/src/Plugin/Group/RelationHandler/AccessControlTrait.php)

#0 /mnt/www/html/llnl8/docroot/modules/contrib/group/src/Entity/Access/GroupRelationshipAccessControlHandler.php(61): Drupal\group\Plugin\Group\RelationHandler\GroupMembershipAccessControl->relationshipCreateAccess(NULL, Object(Drupal\Core\Session\AccountProxy), true)
#1 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(260): Drupal\group\Entity\Access\GroupRelationshipAccessControlHandler->checkCreateAccess(Object(Drupal\Core\Session\AccountProxy), Array, 'group_content_t...')
#2 /mnt/www/html/llnl8/docroot/modules/contrib/entity_clone/entity_clone.module(170): Drupal\Core\Entity\EntityAccessControlHandler->createAccess('group_content_t...', Object(Drupal\Core\Session\AccountProxy), Array, true)
#3 [internal function]: entity_clone_entity_access(Object(Drupal\group\Entity\GroupRelationship), 'clone', Object(Drupal\Core\Session\AccountProxy))
#4 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(426): call_user_func_array(Object(Closure), Array)
#5 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'entity_clone')
#6 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(433): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_access', Object(Closure))
#7 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(96): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_access', Array)
#8 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Entity/ContentEntityBase.php(710): Drupal\Core\Entity\EntityAccessControlHandler->access(Object(Drupal\group\Entity\GroupRelationship), 'clone', Object(Drupal\Core\Session\AccountProxy), true)
#9 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Entity/EntityAccessCheck.php(68): Drupal\Core\Entity\ContentEntityBase->access('clone', Object(Drupal\Core\Session\AccountProxy), true)
#10 [internal function]: Drupal\Core\Entity\EntityAccessCheck->access(Object(Symfony\Component\Routing\Route), Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy))
#11 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array(Array, Array)
#12 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck('access_check.en...', Object(Drupal\Component\Utility\ArgumentsResolver))
#13 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check(Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy), NULL, true)
#14 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Menu/LocalTaskManager.php(327): Drupal\Core\Access\AccessManager->checkNamedRoute('entity.group_co...', Array, Object(Drupal\Core\Session\AccountProxy), true)
#15 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Menu/LocalTaskManager.php(358): Drupal\Core\Menu\LocalTaskManager->getTasksBuild('entity.group_co...', Object(Drupal\Core\Cache\CacheableMetadata))
#16 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php(95): Drupal\Core\Menu\LocalTaskManager->getLocalTasks('entity.group_co...', 0)
#17 /mnt/www/html/llnl8/docroot/core/modules/block/src/BlockViewBuilder.php(171): Drupal\Core\Menu\Plugin\Block\LocalTasksBlock->build()
#18 [internal function]: Drupal\block\BlockViewBuilder::preRender(Array)
#19 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array(Array, Array)
#20 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Render/Renderer.php(772): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
#21 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Render/Renderer.php(363): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#22 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Render/Renderer.php(435): Drupal\Core\Render\Renderer->doRender(Array)
#23 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender(Array, false)
#24 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render(Array)
#25 /mnt/tmp/llnl8/php_storage/twig/a490751/www/twig/6388f022ad714_page.html.twig_QUFzE162WM_REZ5U3k3qFjWcU/g9GjEGhf5L_fY8KOodXiboPrnZItfdP9TIAvqOce_Kw.php(47): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#26 /mnt/www/html/llnl8/vendor/twig/twig/src/Template.php(405): __TwigTemplate_e7bf90eabc4e506ba4e3c088579689be06a96c5b855d4d6638bf96c6463d62fd->doDisplay(Array, Array)
#27 /mnt/www/html/llnl8/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#28 /mnt/www/html/llnl8/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#29 /mnt/www/html/llnl8/docroot/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#30 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('core/themes/cla...', Array)
#31 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Render/Renderer.php(422): Drupal\Core\Theme\ThemeManager->render('page', Array)
#32 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender(Array, false)
#33 /mnt/www/html/llnl8/docroot/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render(Array)
#34 /mnt/tmp/llnl8/php_storage/twig/a490751/www/twig/6388f022ad714_html.html.twig_tlecD8NK8usO-6SnUJQ367Fbt/CdJ47wVzvx89IcQzI5q5M0kybPgd5kRrbW_ECgEJsjo.php(86): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#35 /mnt/www/html/llnl8/vendor/twig/twig/src/Template.php(405): __TwigTemplate_f158574c51359a568de2e70f993f23f4bd68660e15519c5195dc40c7ca836610->doDisplay(Array, Array)
#36 /mnt/www/html/llnl8/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#37 /mnt/www/html/llnl8/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#38 /mnt/www/html/llnl8/docroot/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States shelane

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States astringer

    I can confirm that we had this problem on 9.5 using a clean install of group 3 RC1 and entity clone 2.0.0-alpha1. And a few other modules. Not a surprise, but reporting anyway.

  • πŸ‡©πŸ‡ͺGermany larskleiner

    Now that https://www.drupal.org/project/entity_clone/issues/3205355 πŸ› Add a way to exclude certain entity types from cloning Fixed got committed, you can configure Group relationship as a non-cloneable entity which will resolve this error. Obviously you won't be able to clone Group relationship entities but it's unlikely you'll have a use case for this, at least we don't.

  • πŸ‡¨πŸ‡΄Colombia Freddy Rodriguez BogotΓ‘
  • πŸ‡ΊπŸ‡ΈUnited States shelane

    Regaring #9, I verified that group relationship is not set to be cloned. I still get the white screen when attempting to edit a member of a group. These are the applicable lines in the error stack:

    entity_clone_entity_access(Object, 'clone', Object)
    call_user_func_array(Object, Array) (Line: 426)
    Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'entity_clone') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_access', Object) (Line: 433)
    Drupal\Core\Extension\ModuleHandler->invokeAll('entity_access', Array) (Line: 96)
    Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'clone', Object, 1) (Line: 710)
    Drupal\Core\Entity\ContentEntityBase->access('clone', Object, 1) (Line: 68)
    Drupal\Core\Entity\EntityAccessCheck->access(Object, Object, Object)
    call_user_func_array(Array, Array) (Line: 160)
    Drupal\Core\Access\AccessManager->performCheck('access_check.entity', Object) (Line: 136)
    Drupal\Core\Access\AccessManager->check(Object, Object, NULL, 1) (Line: 93)
    Drupal\Core\Access\AccessManager->checkNamedRoute('entity.group_content.clone_form', Array, Object, 1) (Line: 327)

    When disabling the entity clone module, the editing of a member works just fine.

Production build 0.69.0 2024