From d7fad3385012cd86b33b9262c47040b1c7267826 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 18 Apr 2023 10:59:27 +0200 Subject: [PATCH] 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 --- wcfsetup/install/files/lib/data/style/StyleEditor.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { -- 2.20.1