On a an existing site and a brand new Simplytest.me, attempting to create a new campaign results in unexpected error.
Both the existing site and the Simplytest.me are on Drupal 8.6.1.
Here's the logged error from Simplytest.me.
Error: Call to a member function getTranslationFromContext() on null in Drupal\Core\Entity\ContentEntityForm->initFormLangcodes() (line 313 of /home/dmriq/www/core/lib/Drupal/Core/Entity/ContentEntityForm.php) #0 /home/dmriq/www/core/lib/Drupal/Core/Entity/ContentEntityForm.php(284): Drupal\Core\Entity\ContentEntityForm->initFormLangcodes(Object(Drupal\Core\Form\FormState)) #1 /home/dmriq/www/core/lib/Drupal/Core/Entity/EntityForm.php(107): Drupal\Core\Entity\ContentEntityForm->init(Object(Drupal\Core\Form\FormState)) #2 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState)) #3 /home/dmriq/www/core/lib/Drupal/Core/Form/FormBuilder.php(518): call_user_func_array(Array, Array) #4 /home/dmriq/www/core/lib/Drupal/Core/Form/FormBuilder.php(275): Drupal\Core\Form\FormBuilder->retrieveForm('mailchimp_campa...', Object(Drupal\Core\Form\FormState)) #5 /home/dmriq/www/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('mailchimp_campa...', Object(Drupal\Core\Form\FormState)) #6 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #7 /home/dmriq/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #8 /home/dmriq/www/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #9 /home/dmriq/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #10 /home/dmriq/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #11 /home/dmriq/www/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 /home/dmriq/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #13 /home/dmriq/www/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /home/dmriq/www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /home/dmriq/www/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /home/dmriq/www/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /home/dmriq/www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /home/dmriq/www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /home/dmriq/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /home/dmriq/www/core/lib/Drupal/Core/DrupalKernel.php(665): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /home/dmriq/www/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #22 {main}.
Not really sure where to start looking to fix this issue. Did something change in 8.6.x that needs to be addressed?
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | mailchimp-create_campaign_error-2999528-14.patch | 1.31 KB | albertski |
| #10 | 2999528-10.patch | 877 bytes | nathandentzau |
Comments
Comment #2
stephen ollmanSame error here on fresh install with 8.6.0
Comment #3
redeight commentedI did notice that Automated Testing is failing for all php versions with Drupal 8.6. I'm not sure that is related though as it seems to be a failed profile install in the test system rather than something wrong with the Mailchimp module...
Comment #4
jaims-dev commentedAdditional info that might be useful:
$form_state->set('langcode', $this->entityRepository->getTranslationFromContext($this->entity)->language()->getId());When up untill the previous version (8.5.x) the code was:
$form_state->set('langcode', $this->entityManager->getTranslationFromContext($this->entity)->language()->getId());Comment #5
albertski commentedAttached patch fixes the issue.
Comment #6
redeight commented#5 works wonderfully. Thank you!
Comment #7
stephen ollman+1 #5 patch.
Comment #8
szeidlerThanks for the patch #5. It's working fine for me in Drupal 8.6.1 and a multilingual environment.
The failing tests are unrelated to this issue here.
Comment #9
nathandentzauWe should depend on the interface, not the concrete class of
QueryBase.Comment #10
nathandentzauMy apologies, I see that QueryBase is already in this module. Upon further investigation, the
MailchimpCampaignFormis overriding theContentEntityForm::__construct()andContentEntityForm::create()methods for the entity query factory service, however it's never used in the class. I suggest we remove this all together.Comment #11
nathandentzauUpdated to critical because it's throwing a fatal error on the campaigns management page.
Comment #13
lluvigneI think that proposed solution from @nathandentzau at #10 is the correct way to solve this issue. I tested locally on a fresh Drupal 8.6.1 install and all works fine.
Comment #14
albertski commentedAgree with @ nathandentzau. I updated the patch to remove the unused Use statements.
Comment #15
szeidlerThank you both for simplifying the patch. It is working fine for me.
Comment #17
rjacobsen0 commentedComment #19
rjacobsen0 commentedWrong message. Will commit again soon.
Comment #20
OCTOGONE.dev commentedthank you @ albertski & nathandentzau
patch #14 is working for me.
Comment #21
GeoffGlasson commentedI'm unfamiliar with the module's release cycle, so I was wondering when this patch is likely to be pushed out into a production release, especially given that the released module is effectively unusable due to this bug. Any update would be most appreciated. Thanks.
Comment #22
samuel.mortensonComment #23
rjacobsen0 commentedCommitting correct patch with correct message.
Comment #24
rjacobsen0 commented