Fatal error 'calling hasPendingRevision() on null' when viewing group with workbench_moderation installed

Created on 12 August 2021, over 3 years ago
Updated 22 May 2024, 6 months ago

Problem/Motivation

When Workbench Moderation β†’ is installed, even if it is not enabled for Group type, $this->moderationInfo is null.

Steps to reproduce

  1. Install group Version: 8.x-1.2
  2. Install workbench_moderation Version: 8.x-1.6
  3. Create Group type (do not enable moderation)
  4. Create a group
  5. Upgrade group to Version: 8.x-1.4
  6. Install devel_entity_updates and run `drush entup` to resolve "Mismatched entity and/or field definitions" on status page
  7. Navigate to group page

Error encountered:

Error: Call to a member function hasPendingRevision() on null in Drupal\group\Entity\Access\GroupLatestRevisionCheck->access() (line 76 of /code/web/modules/contrib/group/src/Entity/Access/GroupLatestRevisionCheck.php)
#0 [internal function]: Drupal\group\Entity\Access\GroupLatestRevisionCheck->access(Object(Symfony\Component\Routing\Route), Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy))
#1 /code/web/core/lib/Drupal/Core/Access/AccessManager.php(159): call_user_func_array(Array, Array)
#2 /code/web/core/lib/Drupal/Core/Access/AccessManager.php(135): Drupal\Core\Access\AccessManager->performCheck('access_check.gr...', Object(Drupal\Component\Utility\ArgumentsResolver))
#3 /code/web/core/lib/Drupal/Core/Access/AccessManager.php(92): Drupal\Core\Access\AccessManager->check(Object(Drupal\Core\Routing\RouteMatch), Object(Drupal\Core\Session\AccountProxy), NULL, true)
#4 /code/web/core/lib/Drupal/Core/Menu/LocalTaskManager.php(347): Drupal\Core\Access\AccessManager->checkNamedRoute('entity.group.la...', Array, Object(Drupal\Core\Session\AccountProxy), true)
#5 /code/web/core/lib/Drupal/Core/Menu/LocalTaskManager.php(378): Drupal\Core\Menu\LocalTaskManager->getTasksBuild('entity.group.ca...', Object(Drupal\Core\Cache\CacheableMetadata))
#6 /code/web/core/lib/Drupal/Core/Menu/Plugin/Block/LocalTasksBlock.php(95): Drupal\Core\Menu\LocalTaskManager->getLocalTasks('entity.group.ca...', 0)
#7 /code/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\Core\Menu\Plugin\Block\LocalTasksBlock->build()
#8 [internal function]: Drupal\block\BlockViewBuilder::preRender(Array)
#9 /code/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(100): call_user_func_array(Array, Array)
#10 /code/web/core/lib/Drupal/Core/Render/Renderer.php(781): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'silenced_deprec...', 'Drupal\\Core\\Ren...')
#11 /code/web/core/lib/Drupal/Core/Render/Renderer.php(372): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#12 /code/web/core/lib/Drupal/Core/Render/Renderer.php(444): Drupal\Core\Render\Renderer->doRender(Array)
#13 /code/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, false)
#14 /code/web/core/lib/Drupal/Core/Template/TwigExtension.php(501): Drupal\Core\Render\Renderer->render(Array)
#15 /tmp/rolling/76791d3/twig/61147a6c4135e_page.html.twig_AkmCHS0iTlp8ZFpRyqcRbs0Jy/F-l5YyjYov9pIdsFFZPGrygywBaC1qm1QhbNjwczEls.php(117): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#16 /code/vendor/twig/twig/src/Template.php(453): __TwigTemplate_803cc553ea3f15052a332442dd24872500411781b0c93dfaa99a5718f78ef275->doDisplay(Array, Array)
#17 /code/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array)
#18 /code/vendor/twig/twig/src/Template.php(432): Twig\Template->display(Array)
#19 /code/web/core/themes/engines/twig/twig.engine(64): Twig\Template->render(Array)
#20 /code/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/custom/a...', Array)
#21 /code/web/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Theme\ThemeManager->render('page', Array)
#22 /code/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, false)
#23 /code/web/core/lib/Drupal/Core/Template/TwigExtension.php(501): Drupal\Core\Render\Renderer->render(Array)
#24 /tmp/rolling/76791d3/twig/61147a6c4135e_html.html.twig_1MnzjE9GTw1-a59nsaqLjKpyd/AqHez789FqCSDDz2FYZpyNwMx6GK5T2rTKCqEZBfhdY.php(219): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#25 /code/vendor/twig/twig/src/Template.php(453): __TwigTemplate_4295a6fbfef2f60cd3f5d64b88c2f25dfac196e25ebb12b3b8d971ce51db905d->doDisplay(Array, Array)
#26 /code/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array)
#27 /code/vendor/twig/twig/src/Template.php(432): Twig\Template->display(Array)
#28 /code/web/core/themes/engines/twig/twig.engine(64): Twig\Template->render(Array)
#29 /code/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/custom/a...', Array)
#30 /code/web/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Theme\ThemeManager->render('html', Array)
#31 /code/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, false)
#32 /code/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(147): Drupal\Core\Render\Renderer->render(Array)
#33 /code/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#34 /code/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(148): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#35 /code/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#36 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#37 /code/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#38 /code/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent))
#39 /code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#40 /code/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /code/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /code/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#44 /code/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#45 /code/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#46 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#47 /code/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#48 /code/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#49 {main}

Proposed resolution

  • Check for null for $this->moderationInfo

Remaining tasks

  1. Peer Review patch

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ› Bug report
Status

RTBC

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States teknorah Mokena, IL, US

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.

Production build 0.71.5 2024