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

Created on 2 October 2023, 12 months ago
Updated 3 October 2023, 12 months ago

In Element\Fivestar.php, entityQuery is called without an accessCheck(). This has been deprecated and throws an error: https://www.drupal.org/node/3201242 β†’

πŸ› Bug report
Status

Fixed

Component

Code

Created by

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

Comments & Activities

  • Issue created by @dkosbob
  • The attached patch should fix the error, though I am not actually sure if the accessCheck should be TRUE or FALSE. The default is TRUE.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update 12 months ago
    4 pass
  • πŸ‡ΊπŸ‡ΈUnited States wxman

    Would this be the reason my newly upgraded to D10 is now showing me this:
    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).

    It's happening on every page that has fivestar on it. I'm using the alpha4 release, and added this to the composer.json:

            "drupal/fivestar": {
                "#3391088 Entity queries must explicitly set": "https://www.drupal.org/files/issues/2023-10-02/fivestar-access-check-3391088-2.patch"
            },
    

    Something might not be working with the patch though because I don't see it being applied when I run composer update.

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    πŸ“Œ Relying on entity queries to check access by default is deprecated in drupal:9.2.0. Closed: works as designed

    Update should have been run before upgrading to D10 - update hooks by definition contain code that must work in the previous version.

    The latest alpha4 release should not have changed compatibility with core because there are update functions that were never in a release.

  • heddn Nicaragua

    incorporated #4 at time of commit. thanks for the fixes here.

  • Status changed to Fixed 12 months ago
    • heddn β†’ committed 55ded348 on 8.x-1.x
      Issue #3391088 by dkosbob, TR, heddn: Error: Entity queries must...
  • πŸ‡ΊπŸ‡ΈUnited States wxman

    Is the patch I said I am using in #3 still the correct one when using alpha4?

  • πŸ‡ΊπŸ‡ΈUnited States wxman

    That was my fault. The patch does work, I just formatted it wrong. Very fussy that composer.json is sometimes. The patch did apply and that error went away. I'm still left with one error, but I'm working on it.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024