Empty variable not permitted in PHP 8 str_replace if event registration is not limited to any roles

Created on 5 December 2023, 7 months ago
Updated 15 December 2023, 6 months ago

Problem/Motivation

In Drupal 10 on PHP 8.2, viewing an Event Instance logs the following deprecation notice when the permitted registration roles area ("Which roles can register for this series?") is NULL when creating an event:

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\recurring_events_registration\RegistrationCreationService->registrationPermittedRoles() (line 885 of modules/contrib/recurring_events/modules/recurring_events_registration/src/RegistrationCreationService.php).

Steps to reproduce

Create an event with registration enabled.

Leave all of the checkboxes empty for the "Which roles can register for this series?" field.

Save the event.

View one of the event instances and see the deprecation notice in log or displayed, according to your site's settings.

Proposed resolution

Add a check within registrationPermittedRoles() method to make sure permitted roles is not empty.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Recurring Events Registration (Submodule)

Created by

πŸ‡¨πŸ‡¦Canada endless_wander

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

Comments & Activities

Production build 0.69.0 2024