PHP 8.1: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, bool given

Created on 3 August 2023, over 1 year ago
Updated 18 October 2023, about 1 year ago

Problem/Motivation

[warning] foreach() argument must be of type array|object, bool given DrupalMemcachedBase.php:164
PHP Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, bool given in /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/DrupalMemcachedBase.php:174
Stack trace:
#0 /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/DrupalMemcachedBase.php(174): sizeof()
#1 /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/DrupalMemcachedBase.php(140): Drupal\memcache_storage\DrupalMemcachedBase->addServers()
#2 /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/DrupalMemcached.php(59): Drupal\memcache_storage\DrupalMemcachedBase->__construct()
#3 /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/DrupalMemcachedFactory.php(86): Drupal\memcache_storage\DrupalMemcached->__construct()
#4 /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/MemcachedBackendFactory.php(64): Drupal\memcache_storage\DrupalMemcachedFactory->get()
#5 /var/www/html/undp-cbi/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php(89): Drupal\memcache_storage\MemcachedBackendFactory->get()
#6 /var/www/html/undp-cbi/core/lib/Drupal/Core/Cache/CacheFactory.php(83): Drupal\Core\Cache\ChainedFastBackendFactory->get()
#7 [internal function]: Drupal\Core\Cache\CacheFactory->get()
#8 /var/www/html/undp-cbi/core/lib/Drupal/Component/DependencyInjection/Container.php(255): call_user_func_array()
#9 /var/www/html/undp-cbi/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#10 /var/www/html/undp-cbi/core/lib/Drupal/Component/DependencyInjection/Container.php(434): Drupal\Component\DependencyInjection\Container->get()
#11 /var/www/html/undp-cbi/core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters()
#12 /var/www/html/undp-cbi/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#13 /var/www/html/undp-cbi/core/lib/Drupal/Core/DrupalKernel.php(602): Drupal\Component\DependencyInjection\Container->get()
#14 /var/www/html/undp-cbi/core/includes/utility.inc(35): Drupal\Core\DrupalKernel->preHandle()
#15 /var/www/html/undp-cbi/vendor/drush/drush/src/Commands/core/CacheCommands.php(234): drupal_rebuild()
#16 [internal function]: Drush\Commands\core\CacheCommands->rebuild()
#17 /var/www/html/undp-cbi/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array()
#18 /var/www/html/undp-cbi/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#19 /var/www/html/undp-cbi/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#20 /var/www/html/undp-cbi/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor->process()
#21 /var/www/html/undp-cbi/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#22 /var/www/html/undp-cbi/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run()
#23 /var/www/html/undp-cbi/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand()
#24 /var/www/html/undp-cbi/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#25 /var/www/html/undp-cbi/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run()
#26 /var/www/html/undp-cbi/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun()
#27 /var/www/html/undp-cbi/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run()
#28 /var/www/html/undp-cbi/vendor/drush/drush/drush(4): require('...')
#29 /var/www/html/undp-cbi/vendor/bin/drush(117): include('...')
#30 {main}
thrown in /var/www/html/undp-cbi/modules/contrib/memcache_storage/src/DrupalMemcachedBase.php on line 174

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • PHP 8.1

    The issue particularly affects sites running on PHP version 8.1.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024