Deprecated: explode(): Passing null to parameter #2 ($string) error when managing display of Shipment type

Created on 26 September 2024, 3 months ago

Problem/Motivation

When trying to manage the fields on a Shipment Type, multiple Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /var/www/html/web/core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php on line 188 warnings are logged. Additionally any field operations can not be performed due to those errors littering the AJAX request return.

The root issue seems to be that there are no mimetypes mapped for the extensions (zpl, epl, epl2) defined in the hook_entity_base_field_info function. See here: https://git.drupalcode.org/project/commerce_shipping_label/-/blob/1.0.x/...

Steps to reproduce

Enable commerce_shipping_label and an extension module (currently commerce_easypost).
Configure shipments.
Go to manage display of the Shipment type.
These deprecation errors will result.

Proposed resolution

The mimetypes need to be mapped potentially through hook_file_mimetype_mapping_alter.

However I wonder if these extensions should be defined in this module at all. As this is a generic API module for extensions to then use. Maybe it should be up to the extensions to then define the necessary extensions and mimetypes necessary for their use.

Remaining tasks

  • Add mimetypes for zpl, epl, and epl2 extensions
  • OR
  • Remove zpl, epl, epl2 extensions from the FieldDefinition
πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

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