Cron Execution issue - Error: Call to a member function id() on bool in Drupal\linkchecker\Plugin\LinkStatusHandlerBase->switchSession()

Created on 19 February 2024, 9 months ago

Problem/Motivation

During corn execution if by mistake from '/admin/config/content/linkchecker', somebody set an user under 'Error handling / Impersonate user account' that later for whatever reason, is deleted and the setting is not updated, the hook_cron throws this error because try to load an inexistent user.

Proposed resolution

I have created a patch in which check if the user is loaded, in case that the value of the variable after the user_load is empty, then load the superadmin to avoid Fatal errors during the execution and allow the normal execution of Drupal Cron.

This pathch is and update of:
https://www.drupal.org/project/linkchecker/issues/3247797 🐛 Object of class Drupal\user\Entity\User could not be converted to string Needs work
using this patch:
https://www.drupal.org/files/issues/2022-04-07/object_of_class_user_coul...

🐛 Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

🇪🇸Spain carlosgm91 Alicante

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

Comments & Activities

Production build 0.71.5 2024