TypeError: Cannot access offset of type string on string

Created on 1 December 2023, over 1 year ago

Problem/Motivation

In some cases, we can get the recur_type field's value as a string, but the code expects it to be an array.
This cause 500 error with the following message:

TypeError: Cannot access offset of type string on string in Drupal\recurring_events\Plugin\Field\FieldWidget\YearlyRecurringDateWidget->validateForm() (line 111 of /var/www/docroot/modules/contrib/recurring_events/src/Plugin/Field/FieldWidget/YearlyRecurringDateWidget.php).

Steps to reproduce

- go to edit entity with Recurring Events fields (ex. /admin/structure/events/series/types/eventseries_type/{type}/edit/form-display)
- set the weight of on of these fields smaller than the "Recur Type" field. Or just move it up Yearly Event, Daily Event, Consecutive Event, Monthly Event, Weekly Event

- save the Form Display
- go to edit entity of Event series type which the display's form settings you've just updated
- edit the entity
- save the entity
- verify that you've got an error

Proposed resolution

Let's fix it

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Recurring Events (Main module)

Created by

πŸ‡ΊπŸ‡¦Ukraine aleevas

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