See https://www.woltlab.com/community/thread/302775-fatal-error-invalid-value-source/
+++ /dev/null
-<?php
-
-/**
- * Fixes the style variable value of `individualScssDarkMode`.
- *
- * @author Alexander Ebert
- * @copyright 2001-2023 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- */
-
-use wcf\system\WCF;
-
-// Fix the default value for style variables.
-$sql = "UPDATE wcf1_style_variable
- SET defaultValueDarkMode = ?
- WHERE variableName = ?";
-$statement = WCF::getDB()->prepare($sql);
-$statement->execute([null, 'individualScssDarkMode']);
-
-// Fixes any bad values stored for existing styles.
-$sql = "UPDATE wcf1_style_variable_value
- SET variableValueDarkMode = ?
- WHERE variableID = (
- SELECT variableID
- FROM wcf1_style_variable
- WHERE variableName = ?
- )";
-$statement = WCF::getDB()->prepare($sql);
-$statement->execute([null, 'individualScssDarkMode']);
--- /dev/null
+<?php
+
+/**
+ * Fixes the style variable value of `individualScssDarkMode`.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2023 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ */
+
+use wcf\system\WCF;
+
+// Fix the default value for style variables.
+$sql = "UPDATE wcf1_style_variable
+ SET defaultValueDarkMode = ?
+ WHERE variableName = ?";
+$statement = WCF::getDB()->prepare($sql);
+$statement->execute([null, 'individualScssDarkMode']);
+
+// Fixes any bad values stored for existing styles.
+$sql = "UPDATE wcf1_style_variable_value
+ SET variableValueDarkMode = ?
+ WHERE variableID = (
+ SELECT variableID
+ FROM wcf1_style_variable
+ WHERE variableName = ?
+ )";
+$statement = WCF::getDB()->prepare($sql);
+$statement->execute([null, 'individualScssDarkMode']);
$prefixLength = \strlen(Style::DARK_MODE_PREFIX);
foreach ($inputVariables as $variableName => $variableValue) {
if (\str_starts_with($variableName, Style::DARK_MODE_PREFIX)) {
- $variablesDarkMode[\substr($variableName, $prefixLength)] = $variableValue;
+ $variableName = \substr($variableName, $prefixLength);
+ if ($variableName === 'individualScssDarkMode') {
+ continue;
+ }
+
+ $variablesDarkMode[$variableName] = $variableValue;
} else {
$variables[$variableName] = $variableValue;
}
$statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->styleID]);
while ($row = $statement->fetchArray()) {
+ if ($row['variableName'] === 'individualScssDarkMode') {
+ continue;
+ }
+
$xml->writeElement('variable', $row['variableValueDarkMode'], ['name' => $row['variableName']]);
}