Poor cacheability of the permissions_by_term_node_grants method

Created on 15 November 2025, 2 months ago

Problem/Motivation

Poor cacheability of the permissions_by_term_node_grants method because of the mistake in the AccessStorage::getGids method.

The $grants variable is initialized with the NULL value and this NULL value can be set to the local cache $this->grantsCache[$user->id()].

On the next run, it's checking if the grants were already processed with this code

   if (!empty($this->grantsCache[$user->id()])) {
      return $this->grantsCache[$user->id()];
    }

So the method will run multiple times in case of $this->grantsCache[$user->id()] value is NULL.

Proposed resolution

Initialize value with an empty array and replace !empty checking with the isset.

✨ Feature request
Status

Active

Version

3.1

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine dench0

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024