Closed (fixed)
Project:
Download Count
Version:
2.2.0
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2025 at 23:21 UTC
Updated:
11 Dec 2025 at 21:04 UTC
Jump to comment: Most recent
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).Update `DownloadCountCacheProcessor::processItem` to merge array keys using `keys` instead of `key`.
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 #3
ericgsmith commentedCode change is good - would require declared core version in info file to be bumped to 10.2 and above
Comment #5
vinodhini.e commentedHi, I've updated the core_version_requirement in the .info.yml file to support both Drupal 10.2+ and future versions, including Drupal 11. Thanks.
Comment #6
vinodhini.e commentedComment #7
xdequinzeUsing keys() instead of key() fixes the error on my Drupal 11 instance at running cron.
Comment #10
usingsession commentedFixed, thanks everyone for your work