@@ -1184,14 +1184,16 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null
1184
1184
function parseCommandsByLineForSudo (Collection $ commands , Server $ server ): array
1185
1185
{
1186
1186
$ commands = $ commands ->map (function ($ line ) {
1187
- if (! str (trim ($ line ))->startsWith ([
1188
- 'cd ' ,
1189
- 'command ' ,
1190
- 'echo ' ,
1191
- 'true ' ,
1192
- 'if ' ,
1193
- 'fi ' ,
1194
- ])) {
1187
+ if (
1188
+ ! str (trim ($ line ))->startsWith ([
1189
+ 'cd ' ,
1190
+ 'command ' ,
1191
+ 'echo ' ,
1192
+ 'true ' ,
1193
+ 'if ' ,
1194
+ 'fi ' ,
1195
+ ])
1196
+ ) {
1195
1197
return "sudo $ line " ;
1196
1198
}
1197
1199
@@ -3863,14 +3865,19 @@ function convertComposeEnvironmentToArray($environment)
3863
3865
{
3864
3866
$ convertedServiceVariables = collect ([]);
3865
3867
if (isAssociativeArray ($ environment )) {
3868
+ // Example: $environment = ['FOO' => 'bar', 'BAZ' => 'qux'];
3866
3869
if ($ environment instanceof Collection) {
3867
3870
$ changedEnvironment = collect ([]);
3868
3871
$ environment ->each (function ($ value , $ key ) use ($ changedEnvironment ) {
3869
- $ parts = explode ('= ' , $ value , 2 );
3870
- if (count ($ parts ) === 2 ) {
3871
- $ key = $ parts [0 ];
3872
- $ realValue = $ parts [1 ] ?? '' ;
3873
- $ changedEnvironment ->put ($ key , $ realValue );
3872
+ if (is_numeric ($ key )) {
3873
+ $ parts = explode ('= ' , $ value , 2 );
3874
+ if (count ($ parts ) === 2 ) {
3875
+ $ key = $ parts [0 ];
3876
+ $ realValue = $ parts [1 ] ?? '' ;
3877
+ $ changedEnvironment ->put ($ key , $ realValue );
3878
+ } else {
3879
+ $ changedEnvironment ->put ($ key , $ value );
3880
+ }
3874
3881
} else {
3875
3882
$ changedEnvironment ->put ($ key , $ value );
3876
3883
}
@@ -3880,6 +3887,7 @@ function convertComposeEnvironmentToArray($environment)
3880
3887
}
3881
3888
$ convertedServiceVariables = $ environment ;
3882
3889
} else {
3890
+ // Example: $environment = ['FOO=bar', 'BAZ=qux'];
3883
3891
foreach ($ environment as $ value ) {
3884
3892
$ parts = explode ('= ' , $ value , 2 );
3885
3893
$ key = $ parts [0 ];
0 commit comments