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.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3347611-php-warning-on-content-10.patch | 705 bytes | kalpanajaiswal |
Issue fork node_read_time-3347611
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
littlepixiez commentedAh, just reviewing this - I think our problem is that our content type was created AFTER the node_read_time was set up, so it didn't have a value in the config. This patch fixes the error though. :) Thanks for the great module!
Comment #5
yivanov commentedThanks a lot, @littlepixiez, for reporting and fixing this issue :)
Comment #6
yivanov commentedComment #8
joshahubbers commentedPatch-version of this patch to be included in composer patches.
Comment #9
joshahubbers commentedComment #10
kalpanajaiswal commentedA patch has been created to fix the warning issue.