Skip to content

Commit

Permalink
Remove calls to spl_object_hash functions (#1763)
Browse files Browse the repository at this point in the history
Remove calls to spl_object_ functions
  • Loading branch information
jderusse committed Sep 18, 2024
1 parent 883cdaa commit b044916
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Credentials/CacheProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Core/src/Credentials/ChainProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b044916

Please sign in to comment.