Undefined array key "connect_nulls"

Created on 14 January 2025, 9 days ago

Problem/Motivation

After updating the Charts from 5.1.0 to 5.1.2 I noticed a problem similar to this issue #3461914 πŸ› Undefined array key "" Active :

Warning: Undefined array key "connect_nulls" in Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->render() (line 336 of /var/www/html/modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php)

here is the related part of the code:

'#connect_nulls' => $chart_settings['display']['connect_nulls'],

Steps to reproduce

Update the Charts from 5.1.0 to 5.1.2, visit any page, and check admin/reports/dblog for Warning: Undefined array key "connect_nulls"

Proposed resolution

'#connect_nulls' => $chart_settings['display']['connect_nulls'] ?? FALSE,
πŸ› Bug report
Status

Active

Version

5.1

Component

Code

Created by

πŸ‡¬πŸ‡ͺGeorgia almador

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

Merge Requests

Comments & Activities

  • Issue created by @almador
  • Pipeline finished with Success
    9 days ago
    Total: 552s
    #395529
  • πŸ‡¦πŸ‡ΉAustria maxilein

    I have the same error and if you google it there are a view others.

    Warning: Undefined array key "connect_nulls" in Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->render() (line 336 of /...//modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php)
    
    #0 /...//core/includes/bootstrap.inc(166): _drupal_error_handler_real()
    #1 /...//modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php(336): _drupal_error_handler()
    #2 /...//core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2177): Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->render()
    #3 /...//core/modules/views/src/ViewExecutable.php(1593): Drupal\views\Plugin\views\display\DisplayPluginBase->render()
    #4 /...//core/modules/views/src/Plugin/views/display/Block.php(133): Drupal\views\ViewExecutable->render()
    #5 /...//core/modules/views/src/ViewExecutable.php(1690): Drupal\views\Plugin\views\display\Block->execute()
    #6 /...//core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay()
    #7 [internal function]: Drupal\views\Element\View::preRenderViewElement()
    #8 /...//core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
    #9 /...//core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
    #10 /...//core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
    #11 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #12 /...//core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
    #13 /...//sites/default/files/php/twig/67862c3a8fea6_viewfield-item.html.twig_K-GaYPZNWd_RyzYVAcCyBbYFE/jdIHjz7GsR44U3CXMdLcawygTY3-F3jzlkYV39vuJcE.php(94): Drupal\Core\Template\TwigExtension->escapeFilter()
    #14 /var/www/vendor/twig/twig/src/Template.php(431): __TwigTemplate_2805eb420b5100c429475342ec366984->block_content()
    #15 /...//sites/default/files/php/twig/67862c3a8fea6_viewfield-item.html.twig_K-GaYPZNWd_RyzYVAcCyBbYFE/jdIHjz7GsR44U3CXMdLcawygTY3-F3jzlkYV39vuJcE.php(77): Twig\Template->yieldBlock()
    #16 /var/www/vendor/twig/twig/src/Template.php(387): __TwigTemplate_2805eb420b5100c429475342ec366984->doDisplay()
    #17 /var/www/vendor/twig/twig/src/Template.php(343): Twig\Template->yield()
    #18 /var/www/vendor/twig/twig/src/Template.php(358): Twig\Template->display()
    #19 /var/www/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
    #20 /...//core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
    #21 /...//core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
    #22 /...//core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
    #23 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #24 /...//core/modules/views/src/Plugin/views/field/EntityField.php(974): Drupal\Core\Render\Renderer->render()
    #25 /...//core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1214): Drupal\views\Plugin\views\field\EntityField->render_item()
    #26 /...//core/modules/views/views.theme.inc(238): Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender()
    #27 [internal function]: template_preprocess_views_view_field()
    #28 /...//core/lib/Drupal/Core/Theme/ThemeManager.php(261): call_user_func_array()
    #29 /...//core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
    #30 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #31 /...//core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1796): Drupal\Core\Render\Renderer->render()
    #32 /...//core/modules/views/src/Plugin/views/style/StylePluginBase.php(769): Drupal\views\Plugin\views\field\FieldPluginBase->theme()
    #33 [internal function]: Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow()
    #34 /...//core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
    #35 /...//core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
    #36 /...//core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
    #37 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #38 /...//core/modules/views/src/Plugin/views/style/StylePluginBase.php(708): Drupal\Core\Render\Renderer->render()
    #39 /...//core/modules/views/src/Plugin/views/style/StylePluginBase.php(574): Drupal\views\Plugin\views\style\StylePluginBase->renderFields()
    #40 /...//core/modules/views/src/Plugin/views/style/StylePluginBase.php(462): Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping()
    #41 /...//core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2177): Drupal\views\Plugin\views\style\StylePluginBase->render()
    #42 /...//core/modules/views/src/ViewExecutable.php(1593): Drupal\views\Plugin\views\display\DisplayPluginBase->render()
    #43 /...//core/modules/views/src/Plugin/views/display/Block.php(133): Drupal\views\ViewExecutable->render()
    #44 /...//core/modules/views/src/ViewExecutable.php(1690): Drupal\views\Plugin\views\display\Block->execute()
    #45 /...//core/modules/views/src/Element/View.php(81): Drupal\views\ViewExecutable->executeDisplay()
    #46 [internal function]: Drupal\views\Element\View::preRenderViewElement()
    #47 /...//core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(113): call_user_func_array()
    #48 /...//core/lib/Drupal/Core/Render/Renderer.php(870): Drupal\Core\Render\Renderer->doTrustedCallback()
    #49 /...//core/lib/Drupal/Core/Render/Renderer.php(432): Drupal\Core\Render\Renderer->doCallback()
    #50 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #51 /...//core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
    #52 /...//sites/default/files/php/twig/67862c3a8fea6_viewfield-item.html.twig_K-GaYPZNWd_RyzYVAcCyBbYFE/jdIHjz7GsR44U3CXMdLcawygTY3-F3jzlkYV39vuJcE.php(94): Drupal\Core\Template\TwigExtension->escapeFilter()
    #53 /var/www/vendor/twig/twig/src/Template.php(431): __TwigTemplate_2805eb420b5100c429475342ec366984->block_content()
    #54 /...//sites/default/files/php/twig/67862c3a8fea6_viewfield-item.html.twig_K-GaYPZNWd_RyzYVAcCyBbYFE/jdIHjz7GsR44U3CXMdLcawygTY3-F3jzlkYV39vuJcE.php(77): Twig\Template->yieldBlock()
    #55 /var/www/vendor/twig/twig/src/Template.php(387): __TwigTemplate_2805eb420b5100c429475342ec366984->doDisplay()
    #56 /var/www/vendor/twig/twig/src/Template.php(343): Twig\Template->yield()
    #57 /var/www/vendor/twig/twig/src/Template.php(358): Twig\Template->display()
    #58 /var/www/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
    #59 /...//core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
    #60 /...//core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
    #61 /...//core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
    #62 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #63 /...//core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
    #64 /...//sites/default/files/php/twig/67862c3a8fea6_viewfield.html.twig_jbKm3zPYyIvhEMWL4zUWqEZyo/vNiMG7oVYamrdfqXrJ_KL-xTZwfetLbMnBVYbNa_niM.php(90): Drupal\Core\Template\TwigExtension->escapeFilter()
    #65 /var/www/vendor/twig/twig/src/Template.php(387): __TwigTemplate_17ba97cd14306990d974735319171a51->doDisplay()
    #66 /var/www/vendor/twig/twig/src/Template.php(343): Twig\Template->yield()
    #67 /var/www/vendor/twig/twig/src/Template.php(358): Twig\Template->display()
    #68 /var/www/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
    #69 /...//core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
    #70 /...//core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
    #71 /...//core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
    #72 /...//core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
    #73 /...//core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
    #74 /...//core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
    #75 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #76 /...//core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
    #77 /...//sites/default/files/php/twig/67862c3a8fea6_taxonomy-term.html.twig_w2ZB8F9Rtc_8FNFZ9b45l6QNr/ljPIUo-_dJ38wTy7D8NgQVja92-OCxR8uvX51_vLJk4.php(72): Drupal\Core\Template\TwigExtension->escapeFilter()
    #78 /var/www/vendor/twig/twig/src/Template.php(387): __TwigTemplate_bd68ef3e5b521e89806a5a6eba79c513->doDisplay()
    #79 /var/www/vendor/twig/twig/src/Template.php(343): Twig\Template->yield()
    #80 /var/www/vendor/twig/twig/src/Template.php(358): Twig\Template->display()
    #81 /var/www/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
    #82 /...//core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
    #83 /...//core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
    #84 /...//core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
    #85 /...//core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
    #86 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #87 /...//core/lib/Drupal/Core/Template/TwigExtension.php(484): Drupal\Core\Render\Renderer->render()
    #88 /...//sites/default/files/php/twig/67862c3a8fea6_views-view.html.twig_5u1S5z1PtGibMgkaR-54XZmwm/n7LJrm2QMQXgG3j9XjavnYffRaRLZaSB8YqyCE4U4Z0.php(77): Drupal\Core\Template\TwigExtension->escapeFilter()
    #89 /var/www/vendor/twig/twig/src/Template.php(387): __TwigTemplate_61e96a9b640aa9f1bda9458006520146->doDisplay()
    #90 /var/www/vendor/twig/twig/src/Template.php(343): Twig\Template->yield()
    #91 /var/www/vendor/twig/twig/src/Template.php(358): Twig\Template->display()
    #92 /var/www/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render()
    #93 /...//core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render()
    #94 /...//core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template()
    #95 /...//core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render()
    #96 /...//core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender()
    #97 /...//core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender()
    #98 /...//core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render()
    #99 /...//core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
    #100 /...//core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(231): Drupal\Core\Render\Renderer->executeInRenderContext()
    #101 /...//core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare()
    #102 /...//core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse()
    #103 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    #104 /...//core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
    #105 /var/www/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
    #106 /var/www/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #107 /...//core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
    #108 /...//core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #109 /...//core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #110 /...//core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #111 /...//core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #112 /...//core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #113 /...//core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #114 /...//core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #115 /...//core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #116 /...//core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #117 /...//core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #118 /...//index.php(19): Drupal\Core\DrupalKernel->handle()
    #119 {main}
    
  • πŸ‡¬πŸ‡ͺGeorgia almador

    @maxilein you could apply the patch from this diff:
    https://git.drupalcode.org/project/charts/-/merge_requests/130.diff

    Short instruction (if needed)::
    First, download it to your site's root patches folder. (for example /var/www/patches/130.diff)

    After that:
    composer require cweagans/composer-patches

    and add a patch at the bottom of the composer.json "extra" section

    "extra": {
      "enable-patching": true,
        "patches": {
          "drupal/charts": {
            "Issue #3499637: Undefined array key connect_nulls": "patches/130.diff"}
        } 
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States andileco

    Apologies for letting this warning slip in. @almador - I have updated it to use !empty() rather than ?? FALSE to ensure that the result is boolean. If tests pass, I will commit to dev.

    If you want to remove the error but don't want to patch yet, just re-save your view.

  • Pipeline finished with Skipped
    8 days ago
    #396988
  • πŸ‡ΊπŸ‡ΈUnited States andileco
Production build 0.71.5 2024