Not possible to set an empty UA or IP pattern

Created on 26 May 2025, 11 days ago

Problem/Motivation

This is a followup to 🐛 Wrong config type Active .
The solution implemented does not work correctly when some settings are empty.

Steps to reproduce

  1. Browse to /admin/config/cookie_bot_protection/settings.
  2. Leave the "User-Agent whitelist patterns" and "Ip whitelist patterns with optional mask" fields empty.
  3. Save the form.

It generates this config:

ua_whitelist_patterns:
  - ''
ip_whitelist:
  - ''

This ends up whitelisting everything.

Proposed resolution

I think this happens because when submitting an empty value explode(PHP_EOL, '') returns an array containing an empty string.

Maybe explodeConfigValue() could use array_filter() to remove empty values.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France prudloff Lille

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