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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3406137-str_replace-registrationPermittedRoles-2.patch | 1.51 KB | chrisla |
Comments
Comment #2
chrisla commentedComment #3
chrisla commentedPatch to provide fix to catch empty string earlier
Comment #5
owenbush commentedGood catch, thanks for the fix. Merged into 2.0.x