Problem/Motivation
While running the latest version of group_forum module (2.0.2) the following fatal error causes 500 server error.
Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck()
PHP message: Drupal\Core\Entity\Query\QueryException: Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck(). in /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php on line 141 #0 /app/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(80): Drupal\Core\Entity\Query\Sql\Query->prepare()
php_1 | #1 /app/web/modules/contrib/group_forum/group_forum.module(243): Drupal\Core\Entity\Query\Sql\Query->execute()
php_1 | #2 [internal function]: group_forum_node_grants()
php_1 | #3 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array()
php_1 | #4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
php_1 | #5 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
php_1 | #6 /app/web/core/modules/node/node.module(907): Drupal\Core\Extension\ModuleHandler->invokeAll()
php_1 | #7 /app/web/core/modules/node/src/NodeGrantDatabaseStorage.php(100): node_access_grants()
php_1 | #8 /app/web/core/modules/node/src/NodeAccessControlHandler.php(180): Drupal\node\NodeGrantDatabaseStorage->access()
php_1 | #9 /app/web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(105): Drupal\node\NodeAccessControlHandler->checkAccess()
php_1 | #10 /app/web/core/modules/node/src/NodeAccessControlHandler.php(101): Drupal\Core\Entity\EntityAccessControlHandler->access()
php_1 | #11 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(706): Drupal\node\NodeAccessControlHandler->access()
php_1 | #12 /app/web/core/modules/node/src/Entity/Node.php(195): Drupal\Core\Entity\ContentEntityBase->access()
php_1 | #13 /app/web/core/lib/Drupal/Core/Entity/EntityAccessCheck.php(68): Drupal\node\Entity\Node->access()
php_1 | #14 [internal function]: Drupal\Core\Entity\EntityAccessCheck->access()
php_1 | #15 /app/web/core/lib/Drupal/Core/Access/AccessManager.php(160): call_user_func_array()
php_1 | #16 /app/web/core/lib/Drupal/Core/Access/AccessManager.php(136): Drupal\Core\Access\AccessManager->performCheck()
php_1 | #17 /app/web/core/lib/Drupal/Core/Access/AccessManager.php(93): Drupal\Core\Access\AccessManager->check()
php_1 | #18 /app/web/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php(98): Drupal\Core\Access\AccessManager->checkNamedRoute()
php_1 | #19 /app/web/core/lib/Drupal/Core/EventSubscriber/CustomPageExceptionHtmlSubscriber.php(71): Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->makeSubrequestToCustomPath()
php_1 | #20 /app/web/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php(109): Drupal\Core\EventSubscriber\CustomPageExceptionHtmlSubscriber->on403()
php_1 | #21 [internal function]: Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException()
php_1 | #22 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
php_1 | #23 /app/vendor/symfony/http-kernel/HttpKernel.php(224): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
php_1 | #24 /app/vendor/symfony/http-kernel/HttpKernel.php(89): Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
php_1 | #25 /app/web/modules/contrib/redirect_after_login/src/RedirectMiddleware.php(44): Symfony\Component\HttpKernel\HttpKernel->handle()
php_1 | #26 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\redirect_after_login\RedirectMiddleware->handle()
php_1 | #27 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
php_1 | #28 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
php_1 | #29 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
php_1 | #30 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
php_1 | #31 /app/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
php_1 | #32 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle()
php_1 | #33 {main}
Steps to reproduce
Activate module under Drupal 10.1.x
Proposed resolution
Implement the ->accessCheck(FALSE) to the SQL query.
Remaining tasks
Test the patch by broader community.
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| group_forum_d10_compat.patch | 905 bytes | ivrh |
Comments
Comment #3
jurgenhaasThanks @ivrh, just reviewed and merged your patch. BTW, with issue forks and an MR it is much easier for maintainers to do all that. So, I'd appreciate your contribution and want to encourage you to use those new methods in the future. They will become the only viable option soon anyways.
Comment #5
leeksoup commentedMoving to separate issue since this is closed / fixed.