Problem/Motivation
The website encountered an unexpected error. Please try again later.
TypeError: array_values(): Argument #1 ($array) must be of type array, null given in array_values() (line 116 of modules\contrib\visitors\src\EventSubscriber\KernelTerminateSubscriber.php).
array_values() (Line: 116)
Drupal\visitors\EventSubscriber\KernelTerminateSubscriber->onTerminate()
call_user_func() (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 100)
Symfony\Component\HttpKernel\HttpKernel->terminate() (Line: 32)
Stack\StackedHttpKernel->terminate() (Line: 687)
Drupal\Core\DrupalKernel->terminate() (Line: 22)
Steps to reproduce
Upgrade the module to 8.x-2.10, but don't update the database.
Proposed resolution
add `?? []` so the value is never null.
Issue fork visitors-3305275
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 #4
bluegeek9 commentedComment #5
paintingguy commentedAfter upgrading to the last (8.x-2.11)build I get this error which forces me to remove the visitors block.
Warning: Undefined array key "show_total_visitors" in Drupal\visitors\Plugin\Block\VisitorsBlock->build() (line 96 of modules/visitors/src/Plugin/Block/VisitorsBlock.php).
Comment #6
bluegeek9 commented@paintingguy,
It should work again if you add a new visitors block or save the existing block's configuration form.
I am working on an update so this does not happen to other site builders.
The visitors block now has per block configurations; you can place the visitors block more than once, each with different settings.
Comment #9
bluegeek9 commented