Domain access: TypeError in hook_node_grants can completely crash site

Created on 14 December 2022, almost 2 years ago
Updated 1 July 2024, 5 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

Closed: works as designed

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 over 1 year ago
  • 🇮🇳India sourabhutani

    Patch #5 is working and fixed issue for me.

  • Status changed to Closed: works as designed 5 months ago
  • 🇺🇸United States agentrickard Georgia (US)

    Other code breaking the API is not our responsibility. That issue should be filed upstream with the caller.

Production build 0.71.5 2024