Fatal error: Could not check compatibility (upgrading to 2.0.1)

Created on 25 April 2024, 8 months ago
Updated 28 May 2024, 7 months ago

Problem/Motivation

Upgrading from 1.12 to 2.01 caused a fatal error: Fatal error: Could not check compatibility between Drupal\address\Plugin\Field\FieldFormatter\AddressDefaultFormatter::settingsForm(array $form, Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface $form_state) and Drupal\Core\Field\FormatterBase::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state), because class Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface is not available in /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldFormatter/AddressDefaultFormatter.php on line 144

Steps to reproduce

Upgrade 1.12 to 2.01 using composer.
Add the address field to a content type.
View that content type and it will cause a fatal error.

πŸ’¬ Support request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States acemichael

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

Comments & Activities

  • Issue created by @acemichael
  • Assigned to praveen rani
  • Issue was unassigned.
  • First commit to issue fork.
  • πŸ‡«πŸ‡·France AimadBachar

    Hello,

    I attempted to replicate the fatal error, but I didn't encounter any issues. I utilized PHP 8.1.3, Drupal core 10.2.2, and Composer 2.2.6.

    Could you please provide any specific steps you followed during the upgrade process? Additionally, if you have any screenshots or relevant code snippets, please feel free to share them.

    Furthermore, it would be helpful if you could provide details about your environment, such as the versions of Composer, Drupal core, and PHP you're using.

    Please don't hesitate to consult error logs or debug messages for further insights. I'm more than willing to offer further assistance to help resolve this issue, including exploring alternative solutions if necessary.

  • πŸ‡ΊπŸ‡ΈUnited States acemichael

    Hello,

    We are using Drupal 10.2.5, PHP 8.2.18 and Composer 2.7.4.
    After upgrading we ran update.php and had these updates:

    Module Update ID Type Description
    --------- ------------------------ --------------- ------------------------
    address 9201 hook_update_n 9201 - Add the
    address_line3 field.
    address default_widget_wrapper post-update Add the "Wrapper type"
    setting to the default
    widget.

    We have a content type using the Address field and after upgrading and running update.php we got a fatal error when view that type.

    Fatal error: Could not check compatibility between Drupal\address\Plugin\Field\FieldFormatter\AddressDefaultFormatter::settingsForm(array $form, Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface $form_state) and Drupal\Core\Field\FormatterBase::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state), because class Drupal\address\Plugin\Field\FieldFormatter\FormStateInterface is not available in /var/www/html/web/modules/contrib/address/src/Plugin/Field/FieldFormatter/AddressDefaultFormatter.php on line 144

    Let me know if you need any more info to replicate.

  • πŸ‡·πŸ‡ΈSerbia bojanz

    AddressDefaultFormatter does not have a settingsForm() method in the 2.x branch:
    https://git.drupalcode.org/project/address/-/blob/2.x/src/Plugin/Field/F...

    It sounds like you are applying a patch which is incomplete (didn't add a use statement for the FormStateInterface).

  • πŸ‡ΊπŸ‡ΈUnited States acemichael

    Yes, we were using this patch:
    "Hide domestic country": " https://www.drupal.org/files/issues/2019-02-21/hide_domestic_country_275... β†’ "

    Is there a way to hide domestic country in 2.01 ?

  • Status changed to Fixed 8 months ago
  • πŸ‡·πŸ‡ΈSerbia bojanz

    There you go then. You'll have to fix that patch (just add the use statement you're missing).

    And no, that feature is not in 2.0.x yet.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡ΊπŸ‡ΈUnited States acemichael

    Hi @rishabjasrotia,

    Sorry for the delay!

    We tried adding the latest patch to the 2.01 version and got a "Could not apply patch" error message.
    Before upgrading to 2.01, we removed the old patch, then we upgraded the module, and then tried adding the latest patch.

Production build 0.71.5 2024