Warning on content type updates excluded from read time

Created on 13 March 2023, over 1 year ago
Updated 6 April 2023, over 1 year ago

Problem/Motivation

When saving a node that isn't set to use "read time", I am getting this error:
Warning: Trying to access array offset on value of type null in Drupal\node_read_time\Plugin\Field\NodeReadTime->computeValue() (line 27 of /var/www/html/web/modules/contrib/node_read_time/src/Plugin/Field/NodeReadTime.php) ]

I am trying to figure out if our installation has had it enabled for this node type before and then disabled, as I'm not entirely sure why it's still trying to compute the value, but thought I'd fix it anyway just to suppress the warnings.

Steps to reproduce

Save a node that hasn't got node read time enabled.

Proposed resolution

Add an isset to check the array key exists.

🐛 Bug report
Status

Fixed

Version

1.11

Component

Code

Created by

🇬🇧United Kingdom littlepixiez

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

Comments & Activities

Production build 0.71.5 2024