TypeError in Honeypot 2.2.1 – array_key_exists() Expecting Array, Null Given

Created on 14 February 2025, about 2 months ago
Updated 27 February 2025, about 1 month ago

Problem/Motivation

After upgrading from Honeypot 2.2.0 to 2.2.1, I encountered the following error:
```
title="TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in array_key_exists() (line 151 of /var/www/html/web/modules/contrib/honeypot/src/HoneypotService.php)."
```

and

```
Warning: Undefined array key "elements" in Drupal\honeypot\HoneypotService->addFormProtection() (line 151 of /var/www/html/web/modules/contrib/honeypot/src/HoneypotService.php)
```

This was not an issue in 2.2.0, and it broke my site after the update. If I tried to submit a form it would simply error back with `internal service error`.

Steps to reproduce

I'm using Drupal 10.4.2 and using a Webform with Honeypot. It worked for version 2.2.0 but this issue appeared after upgrading to 2.2.1.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.2

Component

Code

Created by

🇿🇦South Africa joblerstune

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