Passing null to parameter - functions preg_match() and preg_replace()

Created on 20 August 2022, almost 2 years ago
Updated 3 August 2023, 11 months ago

Problem/Motivation

Errors:

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in Cleantalk\Antispam\Cleantalk->createMsg() (line 259 of modules/contrib/cleantalk/src/lib/Cleantalk/Antispam/Cleantalk.php).

Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Cleantalk\Antispam\CleantalkResponse->__construct() (line 133 of modules/contrib/cleantalk/src/lib/Cleantalk/Antispam/CleantalkResponse.php).

Steps to reproduce

Updated to PHP 8.1

Proposed resolution

Check for variables are not NULL before using preg_match and preg_replace functions.

πŸ› Bug report
Status

Needs review

Version

9.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom RhiP

Live updates comments and jobs are added and updated live.
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.69.0 2024