Fall back to plain value if the i18n values are missing
authorAlexander Ebert <ebert@woltlab.com>
Fri, 18 Aug 2023 11:51:05 +0000 (13:51 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 18 Aug 2023 11:51:05 +0000 (13:51 +0200)
Fixes #5622

wcfsetup/install/files/lib/system/form/builder/field/TI18nFormField.class.php

index 33487ed6b3c062cb2f2e5782646283d66d532c88..dc3d4244d0d8e07864417197eb993b08061b55c1 100644 (file)
@@ -373,7 +373,14 @@ trait TI18nFormField
                 $values[$languageItem->languageID] = $languageItem->languageItemValue;
             }
 
-            I18nHandler::getInstance()->setValues($this->getPrefixedId(), $values);
+            if ($values === []) {
+                // The value should be an i18n value but the phrases are missing
+                // for an unknown reason. Recovery by forcing the value to be
+                // treated as plain text. See https://github.com/WoltLab/WCF/issues/5622
+                I18nHandler::getInstance()->setValue($this->getPrefixedId(), $value, true);
+            } else {
+                I18nHandler::getInstance()->setValues($this->getPrefixedId(), $values);
+            }
         } else {
             I18nHandler::getInstance()->setValue($this->getPrefixedId(), $value, !$this->isI18nRequired());
         }