Drupal 10 requires Entity queries must explicitly set whether the query should be access checked or not

Created on 23 February 2023, over 1 year ago
Updated 28 February 2023, over 1 year ago

Problem/Motivation

Drupal 10 requires "Entity queries must explicitly set whether the query should be access checked or not". This rule is not followed on MenuLinksController class causing an error. The function deleteDeletedMenuLinks must be patched.

Steps to reproduce

1) create a structure_sync.data.yml in file system (see attached file as an example)

2) Import the file with drush: "drush config:import --partial --source /path-to-sync.data.yml"

3) import menus with drush: "drush im --choice full"
4) Message appears on console:

# drush im --choice full
Importing menu links...
Using "Full" import style
 [notice] Menu links import started
 [notice] Using "full" style for menu links import

In Query.php line 141:
                                                                                                                                         
  Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::ac  
  cessCheck().                                                                                                                           
                                                                                                                                         

Proposed resolution

Modify Drupal\structure_sync\Controller\MenuLinksController:deleteDeletedMenuLinks function line 225:
$ids = $query->execute();
and add accessCheck()
A proposed patch file was added to the ticket, but it is not clear for me if accessCheck(FALSE) is the solution.

🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇦🇷Argentina gmateos

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

Comments & Activities

Production build 0.71.5 2024