Trying to access array offset on value of type null [OfficeHoursItemList->getFieldRows()]

Created on 27 February 2025, 11 days ago

Problem/Motivation

A warning is triggered when accessing an array offset on a null value in the Office Hours module. The error occurs in the OfficeHoursItemList->getFieldRows() method, located in the OfficeHoursFormatterTrait.php file.

Steps to reproduce

1. Install the Office Hours module
2. Navigate to a page that displays office hours or triggers the formatter trait
3. Check the logs for the following warning:
Warning: Trying to access array offset on value of type null in Drupal\office_hours\Plugin\Field\FieldType\OfficeHoursItemList->getFieldRows() (line 115 of /modules/contrib/office_hours/src/OfficeHoursFormatterTrait.php)

Proposed resolution

Make merge request based on attached patch

Remaining tasks

Test and review by community

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

1.22

Component

Code

Created by

🇳🇱Netherlands Remco Hoeneveld

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

Comments & Activities

Production build 0.71.5 2024