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 extension (zpl) defined in the hook_entity_base_field_info function. See here: https://git.drupalcode.org/project/commerce_easypost/-/blob/1.0.x/commer...

This issue is an extension of the same error in commerce_shipping_label https://www.drupal.org/project/commerce_shipping_label/issues/3477080 πŸ› Deprecated: explode(): Passing null to parameter #2 ($string) error when managing display of Shipment type Active

Steps to reproduce

Enable commerce_easypost and the required commerce_shipping_label
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. Or possibly removed entirely.

Remaining tasks

  • Add mimetype for zpl extension
  • OR
  • Remove zpl 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