Brackets are wrong causing warning in SetAuthor in line 197

Created on 22 July 2022, over 2 years ago
Updated 29 November 2023, over 1 year ago

Problem/Motivation

I noticed a warning in the logs:

Warning: Trying to access array offset on value of type null in Drupal\set_author\Plugin\EntityShareClient\Processor\SetAuthor->getUserId() (line 197 of /var/www/html/web/modules/contrib/set_author/src/Plugin/EntityShareClient/Processor/SetAuthor.php)

I found that the brackets are wrong in line 199 of version 1.1.2 where its checking !is_null causing the issue:
if (!isset($body['errors']) && !is_null($body['data'] && isset($body['data']['attributes']))) {

I provided a patch to fix the issue.

🐛 Bug report
Status

Fixed

Version

1.2

Component

Code

Created by

🇩🇪Germany ayrmax

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.

Production build 0.71.5 2024