Array support removed from function Merge::key in Drupal 11

Created on 30 July 2025, 16 days ago

Problem/Motivation

DownloadCountCacheProcessor uses a queue to add download count values to the `download_count_cache` table.

Since Drupal 10.2, the use of Merge::key() with an array of multiple values will cause a deprecation warning. See Merge::key() renamed to Merge::keys() โ†’ .

In Drupal 11, running cron following a recorded download (processing of the `download_count` queue), results in an error:

$ drush cron
AssertionError: assert(is_string($field)) in /app/web/core/lib/Drupal/Core/Database/Query/Merge.php on line 330 #0 /app/web/core/lib/Drupal/Core/Database/Query/Merge.php(330): assert(false, 'assert(is_strin...')
#1 /app/web/modules/contrib/download_count/src/Plugin/QueueWorker/DownloadCountCacheProcessor.php(26): Drupal\Core\Database\Query\Merge->key(Array)
#2 /app/web/core/lib/Drupal/Core/Cron.php(208): Drupal\download_count\Plugin\QueueWorker\DownloadCountCacheProcessor->processItem(Object(stdClass))
#3 /app/web/core/lib/Drupal/Core/Cron.php(173): Drupal\Core\Cron->processQueue(Object(Drupal\Core\Queue\DatabaseQueue), Object(Drupal\download_count\Plugin\QueueWorker\DownloadCountCacheProcessor))
#4 /app/web/core/lib/Drupal/Core/Cron.php(100): Drupal\Core\Cron->processQueues()
#5 /app/web/core/lib/Drupal/Core/ProxyClass/Cron.php(75): Drupal\Core\Cron->run()
#6 /app/vendor/drush/drush/src/Commands/core/DrupalCommands.php(58): Drupal\Core\ProxyClass\Cron->run()
#7 [internal function]: Drush\Commands\core\DrupalCommands->cron(Array)
#8 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/symfony/console/Command/Command.php(279): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /app/vendor/symfony/console/Application.php(1094): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run(Array)
#19 /app/vendor/bin/drush.php(119): include('/app/vendor/dru...')
#20 {main}
AssertionError: assert(is_string($field)) in assert() (line 330 of /app/web/core/lib/Drupal/Core/Database/Query/Merge.php).

Steps to reproduce

  1. Download an item that is tracked by Download Count.
  2. Run cron.

Proposed resolution

Update `DownloadCountCacheProcessor::processItem` to merge array keys using `keys` instead of `key`.

๐Ÿ› Bug report
Status

Active

Version

2.2

Component

Code

Created by

๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand amanp Poneke

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024