Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58c7f74

Browse files
minor #42719 [Cache] Fix tests (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] Fix tests | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - :crossed_fingers: Commits ------- 4807fbc Fix tests
2 parents c6f0c4d + 4807fbc commit 58c7f74

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static function ($key, $value, $isHit) {
5151
// Detect wrapped values that encode for their expiry and creation duration
5252
// For compactness, these values are packed in the key of an array using
5353
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
54-
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
54+
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) array_key_first($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
5555
$item->value = $v[$k];
5656
$v = unpack('Ve/Nc', substr($k, 1, -1));
5757
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;

src/Symfony/Component/Cache/Adapter/ProxyAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static function ($key, $innerItem) use ($poolHash) {
5959
// Detect wrapped values that encode for their expiry and creation duration
6060
// For compactness, these values are packed in the key of an array using
6161
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
62-
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
62+
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) array_key_first($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
6363
$item->value = $v[$k];
6464
$v = unpack('Ve/Nc', substr($k, 1, -1));
6565
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;

src/Symfony/Component/Cache/Traits/ApcuTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected function doSave(array $values, int $lifetime)
112112
} catch (\Throwable $e) {
113113
if (1 === \count($values)) {
114114
// Workaround https://github.com/krakjoe/apcu/issues/170
115-
apcu_delete(key($values));
115+
apcu_delete(array_key_first($values));
116116
}
117117

118118
throw $e;

src/Symfony/Component/Cache/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"psr/cache": "^1.0|^2.0",
2626
"psr/log": "^1|^2|^3",
2727
"symfony/cache-contracts": "^1.1.7|^2",
28+
"symfony/polyfill-php73": "^1.9",
2829
"symfony/polyfill-php80": "^1.16",
2930
"symfony/service-contracts": "^1.1|^2",
3031
"symfony/var-exporter": "^4.2|^5.0"

0 commit comments

Comments
 (0)