Site break when placed visitors module

Created on 11 November 2023, 8 months ago
Updated 22 May 2024, about 1 month ago

Problem/Motivation

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: The timestamp must be numeric. in Drupal\Component\Datetime\DateTimePlus::createFromTimestamp() (line 201 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).
Drupal\Core\Datetime\DateFormatter->format(NULL, 'short') (Line: 367)
Drupal\visitors\Plugin\Block\VisitorsBlock->showSinceDate() (Line: 155)
Drupal\visitors\Plugin\Block\VisitorsBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 788)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 374)

Steps to reproduce

1. install and enabled module
2. Add "visitor" block from back-end
3, Then hit any page on which visitor block placed
4. You 'll get above mentioned error on page & page 'll be broken

Proposed resolution

In showSinceDate() function of "VisitorsBlock" block need to add check if since_date variable value exist only then since_date variable need to pass in to this function: $this->dateFormatter->format()

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024