Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
[24-Jul-2020 07:00:50 UTC] TypeError: Argument 1 passed to Drupal\charts\Plugin\views\style\ChartsPluginStyleChart::getSelectedDataFields() must be of the type array, null given, called in D:\wamp64\www\workbench\workbench_d9_test1\modules\contrib\charts\src\Plugin\views\style\ChartsPluginStyleChart.php on line 191 in D:\wamp64\www\workbench\workbench_d9_test1\modules\contrib\charts\src\Plugin\views\style\ChartsPluginStyleChart.php on line 480 #0 D:\wamp64\www\workbench\workbench_d9_test1\modules\contrib\charts\src\Plugin\views\style\ChartsPluginStyleChart.php(191): Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->getSelectedDataFields(NULL)
#1 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views\src\Plugin\views\display\DisplayPluginBase.php(2501): Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->validate()
#2 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views\src\ViewExecutable.php(2112): Drupal\views\Plugin\views\display\DisplayPluginBase->validate()
#3 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views_ui\src\ViewFormBase.php(125): Drupal\views\ViewExecutable->validate()
#4 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views_ui\src\ViewFormBase.php(49): Drupal\views_ui\ViewFormBase->getDisplayTabs(Object(Drupal\views_ui\ViewUI))
#5 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\Entity\EntityForm.php(125): Drupal\views_ui\ViewFormBase->prepareEntity()
#6 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views_ui\src\ViewFormBase.php(26): Drupal\Core\Entity\EntityForm->init(Object(Drupal\Core\Form\FormState))
#7 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\Entity\EntityForm.php(96): Drupal\views_ui\ViewFormBase->init(Object(Drupal\Core\Form\FormState))
#8 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views_ui\src\ViewFormBase.php(41): Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#9 [internal function]: Drupal\views_ui\ViewFormBase->buildForm(Array, Object(Drupal\Core\Form\FormState))
#10 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\Form\FormBuilder.php(532): call_user_func_array(Array, Array)
#11 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\Form\FormBuilder.php(278): Drupal\Core\Form\FormBuilder->retrieveForm('view_edit_form', Object(Drupal\Core\Form\FormState))
#12 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\Entity\EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\views_ui\ViewEditForm), Object(Drupal\Core\Form\FormState))
#13 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\views_ui\src\Controller\ViewsUIController.php(227): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\views_ui\ViewUI), 'edit', Array)
#14 [internal function]: Drupal\views_ui\Controller\ViewsUIController->edit(Object(Drupal\views_ui\ViewUI), 'chart_extension...')
#15 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#16 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\Render\Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#18 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#19 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\http-kernel\HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#20 D:\wamp64\www\workbench\workbench_d9_test1\vendor\symfony\http-kernel\HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#21 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 D:\wamp64\www\workbench\workbench_d9_test1\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 D:\wamp64\www\workbench\workbench_d9_test1\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 D:\wamp64\www\workbench\workbench_d9_test1\core\lib\Drupal\Core\DrupalKernel.php(705): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 D:\wamp64\www\workbench\workbench_d9_test1\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#30 {main}
Steps to reproduce
I have a simple view with table data, and it works on chart 8.3dev
but after updating to chart 8.4dev via composer and rebuilding cache, and attempting to Add "Chart Attachment" to view, i get the WSOD error
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#7 | fix-validate-3161180-7.patch | 1.1 KB | joseph.olstad |
Issue fork charts-3161180
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
GuillaumeDuveauConfirmed
Comment #3
GuillaumeDuveauThis ain't pretty, but fixes the problem.
Comment #4
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedComment #5
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedComment #6
Anaconda777 CreditAttribution: Anaconda777 as a volunteer commentedI am getting this error after upgrading from 8.x-3.3 to 5.0.3
EDIT: GOT IT WORKING, just had to edit the views chart settings which were missing the data value
2022/12/16 18:33:46 [error] 1132#1132: *65 FastCGI sent in stderr: "PHP message: TypeError: Drupal\charts\Plugin\views\style\ChartsPluginStyleChart::getSelectedDataFields(): Argument #1 ($data_providers) must be of type array, null given, called in /var/www/html/site/web/modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php on line 227 in /var/www/html/site/web/modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php on line 622 #0 /var/www/html/site/web/modules/contrib/charts/src/Plugin/views/style/ChartsPluginStyleChart.php(227): Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->getSelectedDataFields()
#1 /var/www/html/site/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2170): Drupal\charts\Plugin\views\style\ChartsPluginStyleChart->render()
#2 /var/www/html/site/web/core/modules/views/src/ViewExecutable.php(1536): Drupal\views\Plugin\views\display\DisplayPluginBase->render()
#3 /var/www/html/site/web/core/mod" while reading response header from upstream, client: 192.168.50.53, server: local.site, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "local.site", referrer: "http://local.site/user/login"
Comment #7
joseph.olstadsee patch
It's a re-roll of #3
An alternative fix would be to add a hook_update that makes sure data_providers is set to a default value.
Comment #10
nikathoneAdded a post update function instead of trying to check if data providers is set because it should actually be set and if it's not it means that the view chart style is not properly set. If you have site running charts version 3 please try this merge request and run the database update.
Comment #12
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedThank you @nikathone for the extensive patch!