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

CommentFileSizeAuthor
#2 fivestar-access-check-3391088-2.patch479 bytesdkosbob

Comments

dkosbob created an issue. See original summary.

dkosbob’s picture

StatusFileSize
new479 bytes

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.

wxman’s picture

Would this be the reason my newly upgraded to D10 is now showing me this on a otherwise blank page:

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.

tr’s picture

See the change record at Access checking must be explicitly specified on content entity queries

Yes, IMO the TRUE argument should be explicitly specified here even though it is the default because it acts as documentation - you immediately know when reading the code that an access check is going to be performed, whereas without the argument you can't tell whether there's even an argument available.

heddn’s picture

Status: Active » Fixed

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

  • heddn committed 55ded348 on 8.x-1.x
    Issue #3391088 by dkosbob, TR, heddn: Error: Entity queries must...
wxman’s picture

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

heddn’s picture

yes.

wxman’s picture

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.

Status: Fixed » Closed (fixed)

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