Error: getCacheTags() on null in Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxFormatter

Created on 17 July 2023, over 1 year ago
Updated 6 August 2024, 6 months ago

Problem/Motivation

Using drupal 10.1.1 PHP 8.2.8
In my logfiles I have a lot of next messages:
cron : starting execution of search_cron(), immediately followed by next error message
php : Call to a member function getCacheTags() on null in Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxFormatter->viewElements() rule 394

Error: Call to a member function getCacheTags() on null in Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxFormatter->viewElements() (regel 394 van /var/www/testingblogs/web/modules/contrib/colorbox/src/Plugin/Field/FieldFormatter/ColorboxFormatter.php)
#0 /var/www/testingblogs/web/core/lib/Drupal/Core/Field/FormatterBase.php(89): Drupal\colorbox\Plugin\Field\FieldFormatter\ColorboxFormatter->viewElements()
#1 /var/www/testingblogs/web/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php(76): Drupal\Core\Field\FormatterBase->view()
#2 /var/www/testingblogs/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(265): Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase->view()
#3 /var/www/testingblogs/web/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(268): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()
#4 /var/www/testingblogs/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(339): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple()
#5 /var/www/testingblogs/web/core/modules/node/src/NodeViewBuilder.php(24): Drupal\Core\Entity\EntityViewBuilder->buildComponents()
#6 /var/www/testingblogs/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(281): Drupal\node\NodeViewBuilder->buildComponents()
#7 /var/www/testingblogs/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(238): Drupal\Core\Entity\EntityViewBuilder->buildMultiple()
#8 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build()
#9 /var/www/testingblogs/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(111): call_user_func_array()
#10 /var/www/testingblogs/web/core/lib/Drupal/Core/Render/Renderer.php(788): Drupal\Core\Render\Renderer->doTrustedCallback()
#11 /var/www/testingblogs/web/core/lib/Drupal/Core/Render/Renderer.php(377): Drupal\Core\Render\Renderer->doCallback()
#12 /var/www/testingblogs/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender()
#13 /var/www/testingblogs/web/core/lib/Drupal/Core/Render/Renderer.php(160): Drupal\Core\Render\Renderer->render()
#14 /var/www/testingblogs/web/core/lib/Drupal/Core/Render/Renderer.php(583): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
#15 /var/www/testingblogs/web/core/lib/Drupal/Core/Render/Renderer.php(159): Drupal\Core\Render\Renderer->executeInRenderContext()
#16 /var/www/testingblogs/web/core/modules/node/src/Plugin/Search/NodeSearch.php(525): Drupal\Core\Render\Renderer->renderPlain()
#17 /var/www/testingblogs/web/core/modules/node/src/Plugin/Search/NodeSearch.php(489): Drupal\node\Plugin\Search\NodeSearch->indexNode()
#18 /var/www/testingblogs/web/core/modules/search/search.module(80): Drupal\node\Plugin\Search\NodeSearch->updateIndex()
#19 /var/www/testingblogs/web/core/lib/Drupal/Core/Cron.php(335): search_cron()
#20 /var/www/testingblogs/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Cron->Drupal\Core\{closure}()
#21 /var/www/testingblogs/web/core/lib/Drupal/Core/Cron.php(318): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#22 /var/www/testingblogs/web/core/lib/Drupal/Core/Cron.php(159): Drupal\Core\Cron->invokeCronHandlers()
#23 /var/www/testingblogs/web/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#24 /var/www/testingblogs/web/core/modules/automated_cron/src/EventSubscriber/AutomatedCron.php(65): Drupal\Core\ProxyClass\Cron->run()
#25 [internal function]: Drupal\automated_cron\EventSubscriber\AutomatedCron->onTerminate()
#26 /var/www/testingblogs/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#27 /var/www/testingblogs/vendor/symfony/http-kernel/HttpKernel.php(100): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#28 /var/www/testingblogs/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(63): Symfony\Component\HttpKernel\HttpKernel->terminate()
#29 /var/www/testingblogs/web/core/lib/Drupal/Core/DrupalKernel.php(688): Drupal\Core\StackMiddleware\StackedHttpKernel->terminate()
#30 /var/www/testingblogs/web/index.php(22): Drupal\Core\DrupalKernel->terminate()
#31 {main}

Steps to reproduce

The error is caused by any manipulation such as opening a content or a view or a contact form to edit.
Even after changing the display format from colorbox to image or even after deleting the content types with images, the error logs persist.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Postponed: needs info

Version

2.0

Component

Code

Created by

🇧🇪Belgium jjgw

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

Comments & Activities

  • Issue created by @jjgw
  • 🇮🇳India kalash-j jaipur

    @jjgw Can you specify how you are getting this error i have tried this module in drupal 10.1 and php 8.2 .I did added the content and check for the error but i am not getting any error .Please share more details on this issue

  • 🇮🇳India abhishek_virasat

    @jjgw. I tried this module in drupal 9 and php 8.1.10. as you provided steps to reach on exact issue, I followed all the steps to reproduce this issue like- edit contact form, add content and deleted content type with Image field . but I am not getting any error. please share more details about this issue that where you getting error.

  • Assigned to abhishek_virasat
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    4 pass
  • @abhishek_virasat opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇮🇳India abhishek_virasat

    @jjgw, I fixed this issue and created MR kindly review the changes

  • We had this problem on our site as well.
    Installed patch, and errors went away.

  • Status changed to RTBC 8 months ago
  • 🇮🇳India manish-31

    I have confirmed that this error does not occur after applying this MR patch. Marking this as RTBC.

  • Status changed to Postponed: needs info 6 months ago
  • 🇺🇸United States paulmckibben Atlanta, GA

    Hi,

    I am unable to reproduce the original issue using the "steps to reproduce" you listed. Therefore, I'm not able to verify the fix. Can you please provide an explicit set of steps necessary to reproduce the issue?

    Thank you.

Production build 0.71.5 2024