From 8385b7dfe89aa4301122c142541793f693801898 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 30 Sep 2024 11:15:23 +0200 Subject: [PATCH] fix: handle edge case when build variables and env variables are in different format --- bootstrap/helpers/shared.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 975edf9ca..9ff05085a 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -3826,6 +3826,21 @@ function convertComposeEnvironmentToArray($environment) { $convertedServiceVariables = collect([]); if (isAssociativeArray($environment)) { + if ($environment instanceof Collection) { + $changedEnvironment = collect([]); + $environment->each(function ($value, $key) use ($changedEnvironment) { + $parts = explode('=', $value, 2); + if (count($parts) === 2) { + $key = $parts[0]; + $realValue = $parts[1] ?? ''; + $changedEnvironment->put($key, $realValue); + } else { + $changedEnvironment->put($key, $value); + } + }); + + return $changedEnvironment; + } $convertedServiceVariables = $environment; } else { foreach ($environment as $value) {