PHP warning in mb_strtolower() when message value is an array

Created on 3 August 2022, over 2 years ago
Updated 28 March 2023, over 1 year ago

Problem/Motivation

When submitting a form with a message field configured as a formatted text box, one gets this PHP warning:

Warning: mb_strtolower() expects parameter 1 to be string, array given in Drupal\webform_spam_words\Plugin\WebformHandler\BlockWordsWebformHandler->validateSpam() (line 60 of .../modules/contrib/webform_spam_words/src/Plugin/WebformHandler/BlockWordsWebformHandler.php)

Steps to reproduce

Create a form with a formatted message field.

Proposed resolution

Check that the field being tested is an array before applying mb_strtolower. If it is, use the value in the 'value' key of the array.
See attached patch.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kenrbnsn New Jersey

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.71.5 2024