diff --git a/src/Core/CHANGELOG.md b/src/Core/CHANGELOG.md index e2f63fb50..71cd2e084 100644 --- a/src/Core/CHANGELOG.md +++ b/src/Core/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changed - Enable compiler optimization for the `sprintf` function. +- Avoid calls to spl_object_ methods when computing cache key. ## 1.22.0 diff --git a/src/Core/src/Credentials/CacheProvider.php b/src/Core/src/Credentials/CacheProvider.php index 428e62e47..f4a206f12 100644 --- a/src/Core/src/Credentials/CacheProvider.php +++ b/src/Core/src/Credentials/CacheProvider.php @@ -33,7 +33,7 @@ public function __construct(CredentialProvider $decorated) public function getCredentials(Configuration $configuration): ?Credentials { - $key = spl_object_hash($configuration); + $key = sha1(serialize($configuration)); if (!\array_key_exists($key, $this->cache) || (null !== $this->cache[$key] && $this->cache[$key]->isExpired())) { $this->cache[$key] = $this->decorated->getCredentials($configuration); } diff --git a/src/Core/src/Credentials/ChainProvider.php b/src/Core/src/Credentials/ChainProvider.php index abc46f032..faf695e1f 100644 --- a/src/Core/src/Credentials/ChainProvider.php +++ b/src/Core/src/Credentials/ChainProvider.php @@ -41,7 +41,7 @@ public function __construct(iterable $providers) public function getCredentials(Configuration $configuration): ?Credentials { - $key = spl_object_hash($configuration); + $key = sha1(serialize($configuration)); if (\array_key_exists($key, $this->lastSuccessfulProvider)) { if (null === $provider = $this->lastSuccessfulProvider[$key]) { return null;