diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index c5d6a0dc25..1c32e3d203 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -93,8 +93,9 @@ public function __construct(Connection $connection, CacheTagsChecksumInterface $ $this->maxRows = $max_rows === NULL ? static::DEFAULT_MAX_ROWS : $max_rows; if (!$serializer) { @trigger_error('Calling DatabaseBackend::__construct() without the $serializer argument is deprecated in drupal:8.8.0. The $serializer argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3014688', E_USER_DEPRECATED); + $serializer = \Drupal::service('serialization.phpserialize'); } - $this->serializer = \Drupal::service('serialization.phpserialize'); + $this->serializer = $serializer; } /** diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php b/core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php index 371227c8bc..08b47211b9 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php @@ -56,8 +56,9 @@ public function __construct(Connection $connection, CacheTagsChecksumInterface $ $this->settings = $settings ?: Settings::getInstance(); if (!$serializer) { @trigger_error('Calling DatabaseBackendFactory::__construct() without the $serializer argument is deprecated in drupal:8.8.0. The $serializer argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3014688', E_USER_DEPRECATED); + $serializer = \Drupal::service('serialization.phpserialize'); } - $this->serializer = \Drupal::service('serialization.phpserialize'); + $this->serializer = $serializer; } /**