From 3ede76af8ff6bcb415cc35986e24de163adf72a9 Mon Sep 17 00:00:00 2001 From: "Simon L." Date: Thu, 31 Oct 2024 13:14:12 +0100 Subject: [PATCH] DockerActionManager: fix getting the tag from the image Signed-off-by: Simon L. --- php/src/Docker/DockerActionManager.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 12a641e0..8ccbe1ec 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -736,16 +736,13 @@ readonly class DockerActionManager { $output = json_decode($this->guzzleClient->get($url)->getBody()->getContents(), true); $containerChecksum = $output['Image']; $tagArray = explode(':', $output['Config']['Image']); - $tag = $tagArray[1]; - apcu_add($cacheKey, $tag); - /** - * @psalm-suppress TypeDoesNotContainNull - * @psalm-suppress DocblockTypeContradiction - */ - if ($tag === null) { + if (isset($tagArray[1])) { + $tag = $tagArray[1]; + } else { error_log("No tag was found when getting the current channel. You probably did not follow the documentation correctly. Changing the channel to the default 'latest'."); $tag = 'latest'; } + apcu_add($cacheKey, $tag); return $tag; } catch (\Exception $e) { error_log('Could not get current channel ' . $e->getMessage());