Skip to content

Commit fed5dd6

Browse files
authored
Remove calls to spl_object_hash functions (#1763)
Remove calls to spl_object_ functions
1 parent 0ee5733 commit fed5dd6

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changed
66

77
- Enable compiler optimization for the `sprintf` function.
8+
- Avoid calls to spl_object_ methods when computing cache key.
89

910
## 1.22.0
1011

src/Credentials/CacheProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(CredentialProvider $decorated)
3333

3434
public function getCredentials(Configuration $configuration): ?Credentials
3535
{
36-
$key = spl_object_hash($configuration);
36+
$key = sha1(serialize($configuration));
3737
if (!\array_key_exists($key, $this->cache) || (null !== $this->cache[$key] && $this->cache[$key]->isExpired())) {
3838
$this->cache[$key] = $this->decorated->getCredentials($configuration);
3939
}

src/Credentials/ChainProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(iterable $providers)
4141

4242
public function getCredentials(Configuration $configuration): ?Credentials
4343
{
44-
$key = spl_object_hash($configuration);
44+
$key = sha1(serialize($configuration));
4545
if (\array_key_exists($key, $this->lastSuccessfulProvider)) {
4646
if (null === $provider = $this->lastSuccessfulProvider[$key]) {
4747
return null;

0 commit comments

Comments
 (0)