From: Tim Düsterhus Date: Tue, 18 Apr 2023 08:59:27 +0000 (+0200) Subject: Fix style variable update in StyleEditor::update() X-Git-Tag: 6.0.0_Alpha_1~237 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d7fad3385012cd86b33b9262c47040b1c7267826;p=GitHub%2FWoltLab%2FWCF.git Fix style variable update in StyleEditor::update() The previous version overwrote the input variables before processing them. It also did not support missing a `variables` key, whereas 5.5 did. see f573c802cc70e929641b7145c1e28ff557ec61ff --- diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index e7e1a0359b..ab390a478c 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -66,14 +66,14 @@ final class StyleEditor extends DatabaseObjectEditor implements IEditableCachedO ); } - $variables = $parameters['variables']; + $inputVariables = $parameters['variables'] ?? null; unset($parameters['variables']); parent::update($parameters); $variables = $variablesDarkMode = []; $prefixLength = \strlen(Style::DARK_MODE_PREFIX); - foreach ($variables as $variableName => $variableValue) { + foreach ($inputVariables as $variableName => $variableValue) { if (\str_starts_with($variableName, Style::DARK_MODE_PREFIX)) { $variablesDarkMode[\substr($variableName, $prefixLength)] = $variableValue; } else {