Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+8 -24
View File
@@ -27,7 +27,6 @@ trait AbstractTrait
private $namespaceVersion = '';
private $versioningIsEnabled = false;
private $deferred = [];
private $ids = [];
/**
* @var int|null The maximum length to enforce for identifiers or null when no limit applies
@@ -94,7 +93,7 @@ trait AbstractTrait
try {
return $this->doHave($id);
} catch (\Exception $e) {
CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached: '.$e->getMessage(), ['key' => $key, 'exception' => $e]);
CacheItem::log($this->logger, 'Failed to check if key "{key}" is cached', ['key' => $key, 'exception' => $e]);
return false;
}
@@ -115,14 +114,13 @@ trait AbstractTrait
}
if ($cleared = true === $cleared || [] === $cleared) {
$this->namespaceVersion = $namespaceVersion;
$this->ids = [];
}
}
try {
return $this->doClear($this->namespace) || $cleared;
} catch (\Exception $e) {
CacheItem::log($this->logger, 'Failed to clear the cache: '.$e->getMessage(), ['exception' => $e]);
CacheItem::log($this->logger, 'Failed to clear the cache', ['exception' => $e]);
return false;
}
@@ -166,8 +164,7 @@ trait AbstractTrait
}
} catch (\Exception $e) {
}
$message = 'Failed to delete key "{key}"'.($e instanceof \Exception ? ': '.$e->getMessage() : '.');
CacheItem::log($this->logger, $message, ['key' => $key, 'exception' => $e]);
CacheItem::log($this->logger, 'Failed to delete key "{key}"', ['key' => $key, 'exception' => $e]);
$ok = false;
}
@@ -191,7 +188,6 @@ trait AbstractTrait
$wasEnabled = $this->versioningIsEnabled;
$this->versioningIsEnabled = (bool) $enable;
$this->namespaceVersion = '';
$this->ids = [];
return $wasEnabled;
}
@@ -205,7 +201,6 @@ trait AbstractTrait
$this->commit();
}
$this->namespaceVersion = '';
$this->ids = [];
}
/**
@@ -216,13 +211,9 @@ trait AbstractTrait
* @return mixed
*
* @throws \Exception
*
* @deprecated since Symfony 4.2, use DefaultMarshaller instead.
*/
protected static function unserialize($value)
{
@trigger_error(sprintf('The "%s::unserialize()" method is deprecated since Symfony 4.2, use DefaultMarshaller instead.', __CLASS__), E_USER_DEPRECATED);
if ('b:0;' === $value) {
return false;
}
@@ -231,9 +222,9 @@ trait AbstractTrait
if (false !== $value = unserialize($value)) {
return $value;
}
throw new \DomainException('Failed to unserialize cached value');
throw new \DomainException('Failed to unserialize cached value.');
} catch (\Error $e) {
throw new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
throw new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
} finally {
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
}
@@ -241,8 +232,9 @@ trait AbstractTrait
private function getId($key)
{
CacheItem::validateKey($key);
if ($this->versioningIsEnabled && '' === $this->namespaceVersion) {
$this->ids = [];
$this->namespaceVersion = '1'.static::NS_SEPARATOR;
try {
foreach ($this->doFetch([static::NS_SEPARATOR.$this->namespace]) as $v) {
@@ -256,19 +248,11 @@ trait AbstractTrait
}
}
if (\is_string($key) && isset($this->ids[$key])) {
return $this->namespace.$this->namespaceVersion.$this->ids[$key];
}
CacheItem::validateKey($key);
$this->ids[$key] = $key;
if (null === $this->maxIdLength) {
return $this->namespace.$this->namespaceVersion.$key;
}
if (\strlen($id = $this->namespace.$this->namespaceVersion.$key) > $this->maxIdLength) {
// Use MD5 to favor speed over security, which is not an issue here
$this->ids[$key] = $id = substr_replace(base64_encode(hash('md5', $key, true)), static::NS_SEPARATOR, -(\strlen($this->namespaceVersion) + 2));
$id = $this->namespace.$this->namespaceVersion.$id;
$id = $this->namespace.$this->namespaceVersion.substr_replace(base64_encode(hash('sha256', $key, true)), static::NS_SEPARATOR, -(\strlen($this->namespaceVersion) + 22));
}
return $id;