diff --git a/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php b/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php index 3d0c7bc5e2..0984ffcb1f 100644 --- a/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php +++ b/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php @@ -211,27 +211,30 @@ protected function catchException(\Exception $e) { } /** - * Normalizes a cache ID in order to comply with database limitations. + * Normalizes a lock name in order to comply with database limitations. * - * @param string $cid - * The passed in cache ID. + * @param string $name + * The passed in lock name. * * @return string - * An ASCII-encoded cache ID that is at most 255 characters long. + * An ASCII-encoded lock name that is at most 255 characters long. */ - protected function normalizeName($cid) { - // Nothing to do if the ID is a US ASCII string of 255 characters or less. - $cid_is_ascii = mb_check_encoding($cid, 'ASCII'); - if (strlen($cid) <= 255 && $cid_is_ascii) { - return $cid; + protected function normalizeName($name) { + // Nothing to do if the name is a US ASCII string of 255 characters or less. + $name_is_ascii = mb_check_encoding($name, 'ASCII'); + + if (strlen($name) <= 255 && $name_is_ascii) { + return $name; } - // Return a string that uses as much as possible of the original cache ID - // with the hash appended. - $hash = Crypt::hashBase64($cid); - if (!$cid_is_ascii) { + // Return a string that uses as much as possible of the original name with + // the hash appended. + $hash = Crypt::hashBase64($name); + + if (!$name_is_ascii) { return $hash; } - return substr($cid, 0, 255 - strlen($hash)) . $hash; + + return substr($name, 0, 255 - strlen($hash)) . $hash; } /**