Workbench, Paragraphs, and PHP 8: Attempt to read property "target_id" on null EntityOperations.php)

Created on 7 February 2022, over 2 years ago
Updated 18 April 2024, 2 months ago

Problem/Motivation

We are trying to update our site to PHP 8, BLT 13 and Drupal 9.3.4 and we are getting this consistent error with Workbench Moderation when many PHP tasks are performed, especially ones with a lot of subtasks. Sometimes it fails the process and other times it just fires off in the background and just reports to dblog.

It seems odd that there are these errors when the module's 1.6 version has passed php 8 validation. But I have seen many of these "assign X on null" throughout this process of upgrading our sites to PHP 8 and I think something might have been missed.

ERROR Message

Error: Attempt to assign property "target_id" on null in Drupal\workbench_moderation\EntityOperations->entityStorageLoad() (line 108 of /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/workbench_moderation/src/EntityOperations.php)
#0 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/workbench_moderation/workbench_moderation.module(94): Drupal\workbench_moderation\EntityOperations->entityStorageLoad(Array, 'paragraph')
#1 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(863): workbench_moderation_entity_storage_load(Array, 'paragraph')
#2 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(394): Drupal\Core\Entity\ContentEntityStorageBase->invokeStorageLoadHook(Array)
#3 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array)
#4 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntity.php(908): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#5 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntity.php(732): Drupal\search_api\Plugin\search_api\datasource\ContentEntity->getPartialItemIds(0)
#6 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Task/IndexTaskManager.php(148): Drupal\search_api\Plugin\search_api\datasource\ContentEntity->getItemIds(0)
#7 [internal function]: Drupal\search_api\Task\IndexTaskManager->trackItems(Object(Drupal\search_api\Task\TaskEvent), 'search_api.task...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#8 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Drupal\search_api\Task\TaskEvent), 'search_api.task...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#9 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Task/TaskManager.php(212): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\search_api\Task\TaskEvent), Object(Drupal\search_api\Task\TaskEvent))
#10 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Task/TaskManager.php(356): Drupal\search_api\Task\TaskManager->executeSpecificTask(Object(Drupal\search_api\Entity\Task))
#11 [internal function]: Drupal\search_api\Task\TaskManager->processBatch(Array, Array, Array)
#12 /mnt/www/html/oursitefoodev/docroot/core/includes/batch.inc(295): call_user_func_array(Array, Array)
#13 /mnt/www/html/oursitefoodev/docroot/core/includes/batch.inc(137): _batch_process()
#14 /mnt/www/html/oursitefoodev/docroot/core/includes/batch.inc(93): _batch_do()
#15 /mnt/www/html/oursitefoodev/docroot/core/modules/system/src/Controller/BatchController.php(55): _batch_page(Object(Symfony\Component\HttpFoundation\Request))
#16 [internal function]: Drupal\system\Controller\BatchController->batchPage(Object(Symfony\Component\HttpFoundation\Request))
#17 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#18 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#19 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#20 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#21 /mnt/www/html/oursitefoodev/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#22 /mnt/www/html/oursitefoodev/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#23 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /mnt/www/html/oursitefoodev/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /mnt/www/html/oursitefoodev/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /mnt/www/html/oursitefoodev/docroot/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /mnt/www/html/oursitefoodev/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /mnt/www/html/oursitefoodev/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))

WARNING Message:

Warning: Attempt to read property "target_id" on null in Drupal\workbench_moderation\EntityOperations->entityStorageLoad() (line 107 of /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/workbench_moderation/src/EntityOperations.php)
#0 /mnt/www/html/oursitefoodev/docroot/core/includes/bootstrap.inc(346): _drupal_error_handler_real(2, 'Attempt to read...', '/mnt/www/html/n...', 107)
#1 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/workbench_moderation/src/EntityOperations.php(107): _drupal_error_handler(2, 'Attempt to read...', '/mnt/www/html/n...', 107)
#2 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/workbench_moderation/workbench_moderation.module(94): Drupal\workbench_moderation\EntityOperations->entityStorageLoad(Array, 'paragraph')
#3 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(863): workbench_moderation_entity_storage_load(Array, 'paragraph')
#4 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(394): Drupal\Core\Entity\ContentEntityStorageBase->invokeStorageLoadHook(Array)
#5 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(346): Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array)
#6 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntity.php(908): Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array)
#7 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Plugin/search_api/datasource/ContentEntity.php(732): Drupal\search_api\Plugin\search_api\datasource\ContentEntity->getPartialItemIds(0)
#8 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Task/IndexTaskManager.php(148): Drupal\search_api\Plugin\search_api\datasource\ContentEntity->getItemIds(0)
#9 [internal function]: Drupal\search_api\Task\IndexTaskManager->trackItems(Object(Drupal\search_api\Task\TaskEvent), 'search_api.task...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#10 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Drupal\search_api\Task\TaskEvent), 'search_api.task...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#11 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Task/TaskManager.php(212): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\search_api\Task\TaskEvent), Object(Drupal\search_api\Task\TaskEvent))
#12 /mnt/www/html/oursitefoodev/docroot/profiles/custom/ourprofilefoo/modules/contrib/search_api/src/Task/TaskManager.php(356): Drupal\search_api\Task\TaskManager->executeSpecificTask(Object(Drupal\search_api\Entity\Task))
#13 [internal function]: Drupal\search_api\Task\TaskManager->processBatch(Array, Array, Array)
#14 /mnt/www/html/oursitefoodev/docroot/core/includes/batch.inc(295): call_user_func_array(Array, Array)
#15 /mnt/www/html/oursitefoodev/docroot/core/includes/batch.inc(137): _batch_process()
#16 /mnt/www/html/oursitefoodev/docroot/core/includes/batch.inc(93): _batch_do()
#17 /mnt/www/html/oursitefoodev/docroot/core/modules/system/src/Controller/BatchController.php(55): _batch_page(Object(Symfony\Component\HttpFoundation\Request))
#18 [internal function]: Drupal\system\Controller\BatchController->batchPage(Object(Symfony\Component\HttpFoundation\Request))
#19 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#20 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#22 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#23 /mnt/www/html/oursitefoodev/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#24 /mnt/www/html/oursitefoodev/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#25 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /mnt/www/html/oursitefoodev/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /mnt/www/html/oursitefoodev/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /mnt/www/html/oursitefoodev/docroot/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /mnt/www/html/oursitefoodev/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /mnt/www/html/oursitefoodev/docroot/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /mnt/www/html/oursitefoodev/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#35 {main}
πŸ› Bug report
Status

RTBC

Version

1.6

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States loopy1492

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024