menu_ui_get_menu_link_defaults accessCheck missing

Created on 31 July 2023, over 1 year ago

Problem/Motivation

After a D9 to D10 upgrade, content can not be edited, getting the following error:

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: 159)
menu_ui_get_menu_link_defaults(Object) (Line: 224)
menu_ui_form_node_form_alter(Array, Object, 'node_resource_edit_form') (Line: 545)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_resource_edit_form') (Line: 840)
Drupal\Core\Form\FormBuilder->prepareForm('node_resource_edit_form', Array, Object) (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 270)
Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 226)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

After the upgrade just go to admin/content page and try to edit any item.

Proposed resolution

Add the missing required accessCheck line on function menu_ui_get_menu_link_defaults

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

🐛 Bug report
Status

Closed: works as designed

Version

10.1

Component
Menu UI 

Last updated 8 days ago

No maintainer
Created by

🇨🇴Colombia jabonillac@gmail.com

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

Comments & Activities

  • Issue created by @jabonillac@gmail.com
  • Status changed to Postponed: needs info over 1 year ago
  • The entity query in menu_ui_get_menu_link_defaults has an access check, and the line numbers in the backtrace don't seem to fully align with those in the 10.1.x branch. I think we need more info for reproduction.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇨🇴Colombia jabonillac@gmail.com

    I am running version 10.1.1, and i was able to solve the issue adding the accessCheck line on menu_ui.module menu_ui_get_menu_link_defaults hook second query, but as you mention, when I created the fork, I can see the code is not the same, I think this is another problem.

    Closing the issue.

Production build 0.71.5 2024