Improve D10 compatibility with entity queries missing relevant accessCheck() calls

Created on 25 April 2023, over 1 year ago
Updated 19 May 2023, over 1 year ago

Problem/Motivation

Relevant change record is available here: https://www.drupal.org/node/3201242

The following snippet makes an entity query without specifying the relevant ::accessCheck(), which is deprecated in 9.2.0 and will throw an exception in Drupal 10 ([# https://www.drupal.org/project/drupal/issues/3244802] ).

https://git.drupalcode.org/project/asset_injector/-/blob/a5446e4e/asset_...

Steps to reproduce

Run a scan of the module with the latest version of https://www.drupal.org/project/upgrade_status

It'll display the following warning:

Relying on entity queries to check access by default is deprecated in drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or FALSE to specify whether access should be checked.

Proposed resolution

Explicitly set whether the query should be access checked or not in the entity query. It should be checked.

Remaining tasks

Provide issue fork/patch.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

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