Skip to content

Commit 1d3494a

Browse files
committed
fix: network handling
fix: environment variable handling
1 parent ee5eb42 commit 1d3494a

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

bootstrap/helpers/shared.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@ function getTopLevelNetworks(Service|Application $resource)
708708
return $value == $networkName || $key == $networkName;
709709
});
710710
if (! $networkExists) {
711-
$topLevelNetworks->put($networkDetails, null);
711+
if (is_string($networkDetails) || is_int($networkDetails)) {
712+
$topLevelNetworks->put($networkDetails, null);
713+
}
712714
}
713715
}
714716
}
@@ -758,7 +760,9 @@ function getTopLevelNetworks(Service|Application $resource)
758760
return $value == $networkName || $key == $networkName;
759761
});
760762
if (! $networkExists) {
761-
$topLevelNetworks->put($networkDetails, null);
763+
if (is_string($networkDetails) || is_int($networkDetails)) {
764+
$topLevelNetworks->put($networkDetails, null);
765+
}
762766
}
763767
}
764768
}
@@ -1608,7 +1612,9 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
16081612
return $value == $networkName || $key == $networkName;
16091613
});
16101614
if (! $networkExists) {
1611-
$topLevelNetworks->put($networkDetails, null);
1615+
if (is_string($networkDetails) || is_int($networkDetails)) {
1616+
$topLevelNetworks->put($networkDetails, null);
1617+
}
16121618
}
16131619
}
16141620
}
@@ -2523,7 +2529,9 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
25232529
return $value == $networkName || $key == $networkName;
25242530
});
25252531
if (! $networkExists) {
2526-
$topLevelNetworks->put($networkDetails, null);
2532+
if (is_string($networkDetails) || is_int($networkDetails)) {
2533+
$topLevelNetworks->put($networkDetails, null);
2534+
}
25272535
}
25282536
}
25292537
}
@@ -3912,11 +3920,13 @@ function convertComposeEnvironmentToArray($environment)
39123920
} else {
39133921
// Example: $environment = ['FOO=bar', 'BAZ=qux'];
39143922
foreach ($environment as $value) {
3915-
$parts = explode('=', $value, 2);
3916-
$key = $parts[0];
3917-
$realValue = $parts[1] ?? '';
3918-
if ($key) {
3919-
$convertedServiceVariables->put($key, $realValue);
3923+
if (is_string($value)) {
3924+
$parts = explode('=', $value, 2);
3925+
$key = $parts[0];
3926+
$realValue = $parts[1] ?? '';
3927+
if ($key) {
3928+
$convertedServiceVariables->put($key, $realValue);
3929+
}
39203930
}
39213931
}
39223932
}

0 commit comments

Comments
 (0)