Closed (duplicate)
Project:
Message
Version:
8.x-1.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2021 at 00:46 UTC
Updated:
2 Feb 2023 at 20:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
eit2103 commentedI receive about 150 notices like the following every time I run Cron. FYI, I'm just testing the module, I have not made any changes on it.
Notice: Undefined index: format in Drupal\message\Entity\MessageTemplate->getText() (line 290 of /code/modules/message/src/Entity/MessageTemplate.php)
#0 /code/core/includes/bootstrap.inc(600): _drupal_error_handler_real(8, 'Undefined index...', '/code/modules/m...', 290, Array)
#1 /code/modules/message/src/Entity/MessageTemplate.php(290): _drupal_error_handler(8, 'Undefined index...', '/code/modules/m...', 290, Array)
#2 /code/modules/message/message.module(144): Drupal\message\Entity\MessageTemplate->getText()
#3 [internal function]: message_entity_extra_field_info()
#4 /code/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('message_entity_...', Array)
#5 /code/core/lib/Drupal/Core/Entity/EntityFieldManager.php(643): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_extra_fi...')
#6 /code/core/modules/layout_builder/src/Plugin/Derivative/ExtraFieldBlockDeriver.php(99): Drupal\Core\Entity\EntityFieldManager->getExtraFields('paragraph', 'undergraduate_p...')
#7 /code/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(101): Drupal\layout_builder\Plugin\Derivative\ExtraFieldBlockDeriver->getDerivativeDefinitions(Array)
#8 /code/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
#9 /code/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(284): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#10 /code/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(175): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
#11 /code/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(22): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#12 /code/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(16): Drupal\Core\Plugin\DefaultPluginManager->getDefinition('system_breadcru...')
#13 /code/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(76): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('system_breadcru...', Array)
#14 /code/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(62): Drupal\Component\Plugin\PluginManagerBase->createInstance('system_breadcru...', Array)
#15 /code/core/modules/block/src/BlockPluginCollection.php(57): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('system_breadcru...')
#16 /code/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\block\BlockPluginCollection->initializePlugin('system_breadcru...')
#17 /code/core/modules/block/src/BlockPluginCollection.php(45): Drupal\Component\Plugin\LazyPluginCollection->get('system_breadcru...')
#18 /code/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(83): Drupal\block\BlockPluginCollection->get('system_breadcru...')
#19 /code/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(99): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->setConfiguration(Array)
#20 /code/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(55): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->addInstanceId('system_breadcru...', Array)
#21 /code/core/modules/block/src/BlockPluginCollection.php(34): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->__construct(Object(Drupal\Core\Block\BlockManager), 'system_breadcru...', Array)
#22 /code/core/modules/block/src/Entity/Block.php(156): Drupal\block\BlockPluginCollection->__construct(Object(Drupal\Core\Block\BlockManager), 'system_breadcru...', Array, 'seven_breadcrum...')
#23 /code/core/modules/block/src/Entity/Block.php(145): Drupal\block\Entity\Block->getPluginCollection()
#24 /code/core/modules/block/src/BlockAccessControlHandler.php(118): Drupal\block\Entity\Block->getPlugin()
#25 /code/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(105): Drupal\block\BlockAccessControlHandler->checkAccess(Object(Drupal\block\Entity\Block), 'view', Object(Drupal\Core\Session\AccountProxy))
#26 /code/core/lib/Drupal/Core/Entity/EntityBase.php(370): Drupal\Core\Entity\EntityAccessControlHandler->access(Object(Drupal\block\Entity\Block), 'view', Object(Drupal\Core\Session\AccountProxy), true)
#27 /code/core/modules/block/src/BlockRepository.php(56): Drupal\Core\Entity\EntityBase->access('view', NULL, true)
#28 /code/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(137): Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array)
#29 /code/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(259): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build()
#30 /code/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#31 /code/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#32 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#33 /code/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#34 /code/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent))
#35 /code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#36 /code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /code/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /code/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /code/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#44 /code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#45 {main}
Comment #3
mohit.bansal623 commentedPlaced isset() condition to avoid notices.
Comment #4
eit2103 commentedFixed it, thank you!
Comment #5
mohit.bansal623 commentedPlease update the status if it is fixed.
Comment #6
jonmcl commentedWhile this patch might fix the symptoms, I do not think it is the cause of the issue.
Do you have email templates that were installed automatically with the message_example module? Specifically the "Example - Create Comment", "Example - Create Node", and "Example - User Register". It appears that the text format doesn't get properly set from the config install when the message_example module is enabled.
Editing and then saving each of those email templates will likely fix the issue.
Comment #7
robertragas commentedHello everyone,
As JonMcL says it's indeed a bandaid to fix the symptoms as it will now totally ignore the text format.
It happens to be that I also ran into the same problem and in our case when you have multilanguage enabled and translate the message templates. When translating the message template it will only save the translation string in an override, not the text format as you cannot translate this.
Then later on in message template where it gets loaded it only gets this translation string thus missing the format itself.
I attached a patch uses the Drupal configuration system to set the override first and then loading it in, which preserves the text format.
Comment #9
jhedstromMarking as a duplicate of #3180999: Notice: Undefined index: format in Drupal\message\Entity\MessageTemplate->getText().