The commerceguys/addressing has added some PHP 7.3 compatible type hints in the current 1.4.0 version, affecting some class overrides of the address module:
https://github.com/commerceguys/addressing/commit/c81ded457fa0cc7d2c9f5b...
This leads to errors like this:
PHP Fatal error: Declaration of Drupal\address\Repository\AddressFormatRepository::processDefinition($countryCode, array $definition) must be compatible with CommerceGuys\Addressing\AddressFormat\AddressFormatRepository::processDefinition(string $countryCode, array $definition): array in /app/web/modules/contrib/address/src/Repository/AddressFormatRepository.php on line 38
should be sufficient to search the code base for "extends External" and have a look at those implementations. I'm lacking time this evening unfortunately - otherwise I'd provide a patch
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | correct_1.9_interface_compatibility_with_1.4-3302484-34.patch | 519 bytes | todd zebert |
| #28 | 3302484-28-for-8.x-1.9.patch | 5.77 KB | goz |
| #19 | 3302484-19.patch | 6.63 KB | jsacksick |
| #18 | 3302484-18.patch | 6.58 KB | jsacksick |
| #16 | 3302484-16.patch | 4.76 KB | jsacksick |
Issue fork address-3302484
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:
- 3302484-commerceguysaddressing-1.4-compatibility
changes, plain diff MR !18
Comments
Comment #4
mglamanRan phpstan, these came back as errors.
Comment #5
mglamanSomething is still broken in the widget. Needs manual review, I just used PHPStan @ level 2 to check.
Comment #6
pookmish commentedRaising priority level.
Comment #7
greatmatter commentedFor those landing here after running an update:
Check to see the version of commerceguys/addressing. If it's 1.4.0, try downgrading to 1.3.0.
composer show | grep addressing
composer require "commerceguys/addressing:1.3.0"
Comment #8
mglamanAnother quick fix:
Comment #9
cobadger commentedPatch forthcoming.
Comment #10
cobadger commentedPatch attached.
Comment #12
danrodPatch #10 works for me, thanks for posting this, I just had this issue when trying to do "drush updatedb" after I did a major update with "composer update"
Comment #13
jsacksick commentedPatch still has issues:
The test is failing due to:
Comment #14
jsacksick commentedThe attached patch should fix the tests. Not 100% sure it's the right fix, but it fixes the test at least.
Comment #15
jsacksick commentedComment #16
jsacksick commentedComment #17
mglamanAddressItem fields fetching property values should do
?? ''to handle null values, so that strings are always returned. At least for mandatory items.Comment #18
jsacksick commentedComment #19
jsacksick commentedForgot a getter.
Comment #21
bojanz commentedBoom.
Comment #22
jsacksick commentedCommitted, thanks everyone!
Comment #23
lindsay.wils commentedHi everyone. Thanks for the work here. Assuming this fix has just been added to the latest dev release? I have one site still on D8 and am seeing this issue also. Any chance someone has patched address 1.9 as yet?
Thanks
Comment #24
greatmatter commentedAnyone who did #7 - make sure you
composer remove commerceguys/addressing
...to allow the dependency to work. It'll probably throw an error:
"Removal failed, commerceguys/addressing is still present, it may be required by another package. See `composer why commerceguys/addressing`." but in my case, at least, the "remove" command updated it to 1.4.1.
YMMV.
Comment #26
makkus183 commentedSame here as in #23
Comment #27
devkinetic commentedFor D8, as noted in #3302485: Fatal Error: commerceguys\addressing, it seems the best thing to do is roll back to 1.3.0.
Comment #28
goz commentedFor people who are still in D8 and use the 8.x-1.9 module version, here is a patch to apply, based on commit #20 which only fix types.
Comment #29
tichris59 commentedGoz, I used with success your patch in Drupal 8.9 thanks !
Comment #30
steveoriolThank you Goz !
Comment #31
drattar commentedi don't solve it by Downgrading commerceguys/addressing.
however i face similar error, but with small differences
instead on line 38.
my issue are here
And also, Goz Patch doesn't work.
Comment #33
todd zebert commentedI agree with dratta that the
3302484-28-for-8.x-1.9.patchin #28 does not work, at least not with 'drupal/address:1.9' and the resulting "commerceguys/addressing":"v1.4.2" (resulting from the module'scomposer.json's requirement of"commerceguys/addressing": "^1.0.7".Comment #34
todd zebert commentedThis patch is for 'drupal/address:1.9' (last D8 module) and the resulting Composer dependency "commerceguys/addressing":"v1.4.x", tested and working.
Comment #35
gumdal commentedThank you Goz, #28 worked for me!