Error when trying to add a field HMS to content

Created on 18 June 2023, over 1 year ago
Updated 11 July 2024, 4 months ago

Problem/Motivation

PHP 8.2.x deprecated the creation of dynamic properties. This is a known and documented deprecation in PHP 8.2.

The 2.0.x branch has multiple cases where class properties are created dynamically without first declaring them.

Steps to reproduce

Configuration:
Use PHP 8.2.x

Steps

  1. Install HMS FIeld and enable module
  2. Add field HMS to a content type
  3. Try to manage the field settings on either the content type's Display or Form Display UI, something that triggers using field widgets
  4. The warning Deprecated function: Creation of dynamic property Drupal\hms_field\Plugin\Field\FieldFormatter\HMSFormatter::$hms_service is deprecated in Drupal\hms_field\Plugin\Field\FieldFormatter\HMSFormatter->__construct() (line 31 of modules/contrib/hms_field/src/Plugin/Field/FieldFormatter/HMSFormatter.php). will be logged to screen or dblog, depending on your site configuration.

Proposed resolution

Declare the property instead of creating it dynamically.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇧🇪Belgium jjgw

Live updates comments and jobs are added and updated live.
  • PHP 8.2

    The issue particularly affects sites running on PHP version 8.2.0 or later.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024