QueryException: Entity queries must explicitly set whether the query should be access checked or not.

Created on 7 March 2023, over 1 year ago

Problem/Motivation

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\config_pages\Entity\ConfigPagesType::postDelete(Object, Array) (Line: 460)

Steps to reproduce

try to delete a config page with drupal 10

Proposed resolution

add acces check as described here: https://www.drupal.org/node/3201242

current (bug):
$config_page_ids = $query->condition('type', $type->id())->execute();

fixed:
$config_page_ids = $query->accessCheck(TRUE)->condition('type', $type->id())->execute();

🐛 Bug report
Status

Fixed

Version

2.12

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024