Problem/Motivation

When we use Memcache(d) in PHP8, the following error occurs:

Fatal error: Uncaught ArgumentCountError: Memcached::getMulti() expects at most 2 arguments, 3 given in /var/www/html/web/modules/contrib/memcache/src/Driver/MemcachedDriver.php:76 Stack trace: 
#0 /var/www/html/web/modules/contrib/memcache/src/Driver/MemcachedDriver.php(76): Memcached->getMulti(Array, NULL, 1) 
#1 /var/www/html/web/modules/contrib/memcache/src/MemcacheBackend.php(139): Drupal\memcache\Driver\MemcachedDriver->getMulti(Array) 
#2 /var/www/html/web/modules/contrib/memcache/src/MemcacheBackend.php(131): Drupal\memcache\MemcacheBackend->getMultiple(Array, false) 
#3 /var/www/html/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php(286): Drupal\memcache\MemcacheBackend->get('last_write_time...') 
#4 /var/www/html/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php(120): Drupal\Core\Cache\ChainedFastBackend->getLastWriteTimestamp() 
#5 /var/www/html/web/core/lib/Drupal/Core/Config/CachedStorage.php(87): Drupal\Core\Cache\ChainedFastBackend->getMultiple(Array) 
#6 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php(165): Drupal\Core\Config\CachedStorage->readMultiple(Array) 
#7 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php(104): Drupal\Core\Config\ConfigFactory->doLoadMultiple(Array, true) 
#8 /var/www/html/web/core/lib/Drupal/Core/Config/ConfigFactory.php(89): Drupal\Core\Config\ConfigFactory->doGet('system.logging') 
#9 /var/www/html/web/core/lib/Drupal.php(417): Drupal\Core\Config\ConfigFactory->get('system.logging') 
#10 /var/www/html/web/core/includes/errors.inc(324): Drupal::config('system.logging') 
#11 /var/www/html/web/core/includes/errors.inc(123): _drupal_get_error_level() 
#12 /var/www/html/web/core/includes/bootstrap.inc(343): error_displayable() 
#13 /var/www/html/web/core/includes/bootstrap.inc(327): _drupal_exception_handler_additional(Object(ArgumentCountError), Object(ArgumentCountError)) 
#14 [internal function]: _drupal_exception_handler(Object(ArgumentCountError)) 
#15 {main} thrown in /var/www/html/web/modules/contrib/memcache/src/Driver/MemcachedDriver.php on line 76

Proposed resolution

Change PHP_MAJOR_VERSION === 7 to PHP_MAJOR_VERSION >= 7 in MemcachedDriver::getMulti()

Issue fork memcache-3191363

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yas created an issue. See original summary.

yas’s picture

Status: Active » Needs review

Please review the MR.

zenkul’s picture

thanks Bro, worked on my D9 php8

japerry’s picture

Status: Needs review » Fixed

  • japerry committed f8a1f7f on 8.x-2.x
    Issue #3191363 by yas: Support PHP8 for Memcache(d)
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.