Encountered an unexpected error while placing block, Missing accessCheck()

Created on 8 August 2023, over 1 year ago

Problem/Motivation

accessCheck() issue on the block plugin.

The website encountered an unexpected error. Please try again later.

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 Drupal\Core\Entity\Query\Sql\Query->prepare() (line 141 of core/lib/Drupal/Core/Entity/Query/Sql/Query.php).
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 84)
Drupal\questions_answers\Plugin\Block\ModerationAlerts->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array(Array, Array) (Line: 111)

Steps to reproduce

  • Enable module
  • Set permissions
  • Render block on the page using block layout.

Proposed resolution

Add accessCheck() in all entity queries.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India keshavv India

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

Comments & Activities

Production build 0.71.5 2024