Fatal error occurs

Created on 14 October 2024, about 1 month ago

Problem/Motivation

The error seems to occur with content types that have Address and OfficeHours fields.

ENV:Drupal 10.3.6, php 8.3.12, Address 2.0.2, Office Hours 8.x-1.19

Thank you.

Steps to reproduce

Access admin/config/content/diff/fields:

Fatal error: Declaration of Drupal\office_hours\Plugin\diff\Field\OfficeHoursFieldDiffBuilder::build(Drupal\Core\Field\FieldItemListInterface $items) must be compatible with Drupal\diff\FieldDiffBuilderInterface::build(Drupal\Core\Field\FieldItemListInterface $field_items): mixed in /app/web/modules/contrib/office_hours/src/Plugin/diff/Field/OfficeHoursFieldDiffBuilder.php on line 25

Diff display of specific content with layout “Split fields” and “Unified Fields”, "Visual inline" is fine.

Fatal error: Declaration of Drupal\address\Plugin\diff\Field\AddressFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items) must be compatible with Drupal\diff\Plugin\diff\Field\CoreFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items): array in /app/web/modules/contrib/address/src/Plugin/diff/Field/AddressFieldBuilder.php on line 24

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇯🇵Japan s-jack Tokyo

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

Comments & Activities

  • Issue created by @s-jack
  • 🇮🇳India kishan@lnwebworks

    kishan@kk made their first commit to this issue’s fork.

  • I'm not sure if I should modify the FieldDiffBuilderInterface like this.
    I deleted the mixed return.

  • Thanks for patch but it didn't work for me because I also have two similar errors from two separate modules.
    I'm not sure if a separate integration is needed for each relevant module.

    Dynamic Entity Reference Module

    Fatal error: Declaration of Drupal\dynamic_entity_reference\Plugin\diff\Field\DynamicEntityReferenceFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items) must be compatible with Drupal\diff\Plugin\diff\Field\EntityReferenceFieldBuilder::build(Drupal\Core\Field\FieldItemListInterface $field_items): array in /var/www/html/d10site/web/modules/contrib/dynamic_entity_reference/src/Plugin/diff/Field/DynamicEntityReferenceFieldBuilder.php on line 25
    

    Smart Date Module

    Fatal error: Declaration of Drupal\smart_date\Plugin\diff\Field\SmartdateFieldBuilder::buildConfigurationForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\diff\FieldDiffBuilderBase::buildConfigurationForm(array $form, Drupal\Core\Form\FormStateInterface $form_state): array in /var/www/html/d10site/web/modules/contrib/smart_date/src/Plugin/diff/Field/SmartdateFieldBuilder.php on line 63
    

    There's a solution for smart date here. Fix diff 2.x integration 🐛 Fix diff 2.x integration Needs review
    But if there is a possibility of getting this similar error in different modules, it would be better to approach the situation on a diff basis.

Production build 0.71.5 2024