- Issue created by @VladimirAus
- π·πΈSerbia bojanz
This is the crashing code:
public function __construct(CacheBackendInterface $cache, LanguageManagerInterface $language_manager) { parent::__construct(); $this->cache = $cache; // The getCurrentLanguage() fallback is a workaround for core bug #2684873. $language = $language_manager->getConfigOverrideLanguage() ?: $language_manager->getCurrentLanguage(); $this->defaultLocale = $language->getId(); }
It should not be possible for $language->getId() to be null. It indicates something very wrong with your site (or a core bug).
I suggest adding some debug code here to see which language is used (config override or current language) and what the value of $language is.
- Status changed to Needs review
about 1 year ago 2:47am 7 March 2024 - π¦πΊAustralia VladimirAus Brisbane, Australia
Thanks @bojanz.
MR is created. - π¦πΊAustralia VladimirAus Brisbane, Australia
VladimirAus β changed the visibility of the branch 3425922-error-cannot-assign to hidden.
- π¦πΊAustralia VladimirAus Brisbane, Australia
VladimirAus β changed the visibility of the branch 3425922-error-cannot-assign to hidden.
- π¦πΊAustralia VladimirAus Brisbane, Australia
VladimirAus β changed the visibility of the branch 3425922-error-cannot-assign to hidden.
- π¦πΊAustralia VladimirAus Brisbane, Australia
VladimirAus β changed the visibility of the branch 3425922-error-cannot-assign to hidden.
- π¦πΊAustralia VladimirAus Brisbane, Australia
VladimirAus β changed the visibility of the branch 3425922-error-cannot-assign to active.
- Merge request !48Issue #3425922: Error <Cannot assign null to property ... β (Open) created by VladimirAus
- last update
about 1 year ago 43 pass - last update
about 1 year ago 43 pass - π·πΈSerbia bojanz
@VladimirAus
Can you give us the output of this:var_dump($language_manager->getConfigOverrideLanguage()); var_dump($language_manager->getConfigOverrideLanguage()->getId());
From what I can see, core issue #2684873: ConfigurableLanguageManager::getConfigOverrideLanguage() returns NULL β was fixed ages ago (Drupal 8.3), so our logic should be as simple as:
$this->defaultLocale = $language_manager->getConfigOverrideLanguage()->getId();
According to the interfaces, getConfigOverrideLanguage() always returns a language, and getId() always returns a string, so a crash should be impossible.
- Assigned to VladimirAus
- Status changed to Postponed: needs info
about 1 year ago 8:37am 23 March 2024 - π¦πΊAustralia VladimirAus Brisbane, Australia
Let me have a look @bojanz
- Issue was unassigned.
- Status changed to Active
9 months ago 9:34pm 4 July 2024 - π·πΈSerbia bojanz
@VladimirAus
Ever managed to look at this?I'd still like to do the simplification from #14.
- π·πΈSerbia bojanz
bojanz β changed the visibility of the branch 3425922-error-cannot-assign to hidden.
- π¦πΊAustralia VladimirAus Brisbane, Australia
Just tested in on
core 10.3.1
andaddress 2.0.2
and can not replicate the issue anymore. π€·ββοΈ -
bojanz β
committed e51970d4 on 2.1.x
Issue #3425922: Remove outdated workarounds for null config override...
-
bojanz β
committed e51970d4 on 2.1.x
- Status changed to Fixed
9 months ago 4:26pm 8 July 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- πΊπΈUnited States kevinquillen
Still getting this in 2.1.x dev:
TypeError: Cannot assign null to property CommerceGuys\Addressing\Validator\Constraints\AddressFormatConstraint::$validatePostalCode of type bool in Symfony\Component\Validator\Constraint->__construct() (line 120 of /var/www/html/vendor/symfony/validator/Constraint.php). CommerceGuys\Addressing\Validator\Constraints\AddressFormatConstraint->__construct() (Line: 31) Drupal\Core\Validation\ConstraintFactory->createInstance() (Line: 83) Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 86) Drupal\Core\Validation\ConstraintManager->create() (Line: 394)