QueryInterface::accessCheck is required on Drupal 10

Created on 22 July 2023, over 1 year ago
Updated 8 February 2024, 11 months ago

Problem/Motivation

Relying on entity queries to check access by default was 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.

See https://www.drupal.org/node/3201242

Proposed resolution

Add accessCheck(FALSE) for entityQuery in src/Plugin/views/sort/DraggableViewsSort.php::getViewSortDataOptions()

🐛 Bug report
Status

Closed: works as designed

Version

2.1

Component

Code

Created by

🇭🇺Hungary szato

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

Comments & Activities

  • Issue created by @szato
  • @szato opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇭🇺Hungary szato

    Created MR with fix.

  • Status changed to Closed: works as designed 11 months ago
  • 🇬🇧United Kingdom james.williams

    As per https://www.drupal.org/node/3201242 , the access check is only required for *content* entities, not *config* entities (like views).

    That said, adding the access check wouldn't do any harm, and as some static analysis can't tell the difference, adding it may still help to avoid warnings in reports. But the lack of the access check won't actually throw an error. Unless you can prove it will from a test?

Production build 0.71.5 2024