strip_tags throwing exception when null passed as link parameter

Created on 16 May 2025, 21 days ago

Problem/Motivation

Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\fileslog\Logger\FilesLog->log() (line 53 of /var/www/html/docroot/modules/contrib/fileslog/src/Logger/FilesLog.php)

Steps to reproduce

We noticed that when using webform and we have disabled submissions, logging still occurs but is sent a null for link field.

  • Create a webform with submissions disabled
  • Submit the webform
  • View the log under Reports -> recent messages
  • The error 'Deprecated function: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in Drupal\fileslog\Logger\FilesLog->log() (line 53 of /var/www/html/docroot/modules/contrib/fileslog/src/Logger/FilesLog.php)'
  • is shown

Proposed resolution

Amend code line in /fileslog/src/Logger/FilesLog.php to below:

'link' => strip_tags($context['link']) ?? "",

Remaining tasks

Make the patch

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇬🇧United Kingdom rosie.catchpole

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024