Skip to content

Commit 5f67192

Browse files
bugfix: addItemToKey will call apcu_store() even when the array key already exists (#75)
Signed-off-by: Paul Kreiner <github-paul@thedeacon.org> Co-authored-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
1 parent cc8622c commit 5f67192

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Prometheus/Storage/APCng.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ private function addItemToKey(string $key, string $item): void
246246
if (false === $arr) {
247247
$arr = [];
248248
}
249-
if (!array_key_exists($item, $arr)) {
250-
$arr[$this->encodeLabelKey($item)] = 1;
249+
$_item = $this->encodeLabelKey($item);
250+
if (!array_key_exists($_item, $arr)) {
251+
$arr[$_item] = 1;
251252
apcu_store($key, $arr);
252253
}
253254
}

0 commit comments

Comments
 (0)