When using the Address module with commerceguys/intl v0.7.3 the system gives an error on installation of Open Social.

Error: Access level to Drupal\address\Repository\CountryRepository::getDefaultLocale() must
be public (as in class CommerceGuys\Intl\Country\CountryRepository) in
/var/www/html/modules/contrib/address/src/Repository/CountryRepository.php, line 16

This is due to the fact that the access level of getDefaultLocale() method in the LocalResolverTrait has been changed to public: https://github.com/commerceguys/intl/commit/1a394eaa338f71c67af9bd1a00f4...

This trait is used in CommerceGuys\Intl\Country\CountryRepository which is extended in Drupal\address\Repository\CountryRepository.

This method should be made public in Drupal\address\Repository\CountryRepository as well.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jaapjan created an issue. See original summary.

jaapjan’s picture

FileSize
652 bytes

  • bojanz committed 2722646 on 8.x-1.x authored by jaapjan
    Issue #2822309 by jaapjan: Access level of Drupal\address\Repository\...
bojanz’s picture

Status: Active » Fixed

Improved the fix and committed, thanks!

I'll tag RC3 within the next 24h.

keboca’s picture

Good catch! #2 works just fine! thanks @jaapjan & @bojanz

FlutterStack’s picture

Good catch! #2 works just fine! thanks @jaapjan & @bojanz

Polly’s picture

Beginner question: On linux I am hoping to use this patch following this tutorial. I am unsure from which directory I should apply this patch. I tried:

root@pollypc:/var/www/html# cd vendor/commerceguys/
root@pollypc:/var/www/html/vendor/commerceguys# patch -p1 < /home/polly/drupal/address-2822309.patch 
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/src/Repository/CountryRepository.php b/src/Repository/CountryRepository.php
|index efe0643..ef577f1 100644
|--- a/src/Repository/CountryRepository.php
|+++ b/src/Repository/CountryRepository.php
--------------------------
File to patch: 

How do I apply this patch?

Or do I understand correctly that I should soon be able to pick up this fix running composer drupal-update (I've just tried with no luck)?

ilya.no’s picture

@Polly, instead of cd vendor/commerceguys/ you should navigate to module's directory, i.e. cd modules/address.

Polly’s picture

@ilya.no Thank you very much. The patch worked for me.

di3gopa’s picture

I can Confirm that the patch works.

di3gopa’s picture

Attaching a patch that works with 1.0-beta3 in case someone needs it.

alexrayu’s picture

Subscribing. Appreciate #11.

bojanz’s picture

Why? There is no reason for anyone to patch an older Address version. Use the latest code.

dpalmer’s picture

Getting this error on the 8.x-1.0-rc3. I don't even see this getDefaultLocale function in the src/Repository/CountryRepository.php to patch it...

I tried the dev branch and same issue.

What am I doing wrong?

bojanz’s picture

@dpalmer You probably tried to update Address outside of Composer, and now your library versions are out of sync. "composer update drupal/address --with-dependencies" is the only way.

dpalmer’s picture

@bojanz ah thanks, that did the trick!

Status: Fixed » Closed (fixed)

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