Domain access: TypeError in hook_node_grants can completely crash site

Created on 14 December 2022, over 1 year ago
Updated 9 May 2024, about 2 months ago

The domain_access_node_grants function attempts to load the user account based on the AccountInterface passed into the function. Occasionally, the user load returns NULL and generates the following error for anonymous users:

TypeError: Argument 1 passed to Drupal\domain_access\DomainAccessManager::getAccessValues() must implement interface Drupal\Core\Entity\FieldableEntityInterface, null given, called in modules/contrib/domain/domain_access/domain_access.module on line 54

This is similar to another issue in the domain entity module I reported https://www.drupal.org/project/domain_entity/issues/3322113

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom intrafusion Edinburgh, UK

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

Comments & Activities

Not all content is available!

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

  • 🇭🇰Hong Kong eric_lee

    one of my colleague also faced this issue
    there was no any issue in modules or core file
    Actually he was copying whole DB and source code to different machine and trying to run drupal
    later we find the users table does not contain 0 uid
    and it was actually at 14 uid, then we updated 14 -> 0 uid and it seems all work fine

  • 🇮🇳India anuragsharmam

    Just to confirm, I have a user with uid 0 and I'm still facing the error.
    After applying the patch from #5, it works fine. I suggest considering the issue and reviewing the suggested patch again.

  • Status changed to Needs review 12 months ago
  • 🇮🇳India sourabhutani

    Patch #5 is working and fixed issue for me.

Production build 0.69.0 2024