InvalidArgumentException thrown in statistics_tokens if the node has never been viewed

Created on 8 July 2018, almost 7 years ago
Updated 6 May 2024, 12 months ago

When statistics_tokens runs and $data['node'] is a node that has never been viewed, $statistics gets set toFALSE, therefore

$replacements[$original] = format_date($statistics['timestamp']);

throws an InvalidArgumentException.

Steps to reproduce:

  • Install Devel
  • Create a node and do not view it (may need to create via REST API or just prevent automatic redirection to view on creation)
  • Go to the devel tab and then the tokens tab
  • InvalidArgumentException is thrown

n.b. I don't think the Devel module is the issue here, it's just a means to demonstrate the issue.

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component
Statistics 

Last updated 28 days ago

No maintainer
Created by

🇬🇧United Kingdom PQ

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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