Error: Call to a member function id() on null i

Created on 20 October 2023, about 1 year ago
Updated 29 January 2024, 11 months ago

Problem/Motivation

WSOD on all site pages for anonymous users, Watchdog error:
Error: Call to a member function id() on null in Drupal\permissions_by_term\Service\AccessCheck->canUserAccessByNode() (line 79 of /web/modules/contrib/permissions_by_term/src/Service/AccessCheck.php)

Steps to reproduce

- Enable / update module
- try to open any website page

Proposed resolution

The simplest: in AccessCheck.php file add an additional check: isset($user) or !empty($user) anywhere near existing if ($user->id()

Perhaps there is a better solution distinguishing anonymous users from logged in.

🐛 Bug report
Status

Fixed

Version

3.1

Component

Code

Created by

🇸🇰Slovakia yurg

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024