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.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screenshot 2024-04-30 at 11.43.28 AM.png | 25.06 KB | acemichael |
| address-fatal-error.png | 102.75 KB | acemichael |
Issue fork address-3443604
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
Praveen rani commentedComment #3
Praveen rani commentedComment #5
aimadbachar commentedHello,
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.
Comment #6
acemichael commentedHello,
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.
Comment #7
bojanz commentedAddressDefaultFormatter 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).
Comment #8
acemichael commentedYes, 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 ?
Comment #9
bojanz commentedThere 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.
EDIT: Looking at the MR for #2753899: Allow hiding display of country for domestic addresses it already has the use statement added, so you probably just need to update your patch.
Comment #10
rishabjasrotia commentedHello @acemichael
Please use the latest patch: https://www.drupal.org/files/issues/2023-11-08/hide_domestic_country-275...
Comment #12
acemichael commentedHi @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.