diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index aec2ef74..3bfca466 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -420,13 +420,13 @@ readonly class DockerActionManager { // Additional Collabora options if ($this->configurationManager->collaboraAdditionalOptions !== '') { - // The regex not not extremely readable, should be the most thorough though. - // \s is any whitespace - // + means one or more token - // (?=) defines a positive lookahead (requirement but won't remove that character - // - the required character after an space - $regEx = '/\s+(?=-)/'; - $requestBody['Cmd'] = preg_split($regEx, $this->configurationManager->collaboraAdditionalOptions); + // Split the list of Collabora options, which are stored as a string but must be assigned as an array. + // To avoid problems with whitespace or dashes in option arguments we use a regular expression + // that splits the string at every position where a whitespace is followed by '--o:'. + // The leading whitespace is removed in the split but the following characters are not. + // Example: "--o:example_config1='some thing' --o:example_config2=something-else" -> ["--o:example_config1='some thing'", "--o:example_config2=something-else"] + $regEx = '/\s+(?=--o:)/'; + $requestBody['Cmd'] = preg_split($regEx, rtrim($this->configurationManager->collaboraAdditionalOptions)); } }