Revert "Fix PHP 8.1 compatibility when saving I18n options"
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 7 Jan 2022 08:50:28 +0000 (09:50 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 7 Jan 2022 08:50:28 +0000 (09:50 +0100)
During the discussion within the PR is was decided to opt for a different, less
invasive, fix, because the impact of this change is not really clear.

This reverts commit b46c272b28ba84892534b31c641a6dd412bb0a1e.

wcfsetup/install/files/lib/system/option/OptionHandler.class.php

index 2f2e10e6ade4cce2e2f5aa95ad2031e0b6c858ad..b167df80986471bfedff8c9a1467fb4baddc6ef6 100644 (file)
@@ -393,22 +393,18 @@ class OptionHandler implements IOptionHandler
         // get new value
         $newValue = $this->rawValues[$option->optionName] ?? null;
 
-        // Skip validation for I18n options. They are special cased and are not provided
-        // within the `rawValues`, thus causing validation to be effectively useless.
-        if (!$this->supportI18n || !$option->supportI18n) {
-            // get save value
-            $this->optionValues[$option->optionName] = $typeObj->getData($option, $newValue);
-
-            // validate with pattern
-            if ($option->validationPattern) {
-                if (
-                    !\preg_match(
-                        '~' . \str_replace('~', '\~', $option->validationPattern) . '~',
-                        $this->optionValues[$option->optionName]
-                    )
-                ) {
-                    throw new UserInputException($option->optionName, 'validationFailed');
-                }
+        // get save value
+        $this->optionValues[$option->optionName] = $typeObj->getData($option, $newValue);
+
+        // validate with pattern
+        if ($option->validationPattern) {
+            if (
+                !\preg_match(
+                    '~' . \str_replace('~', '\~', $option->validationPattern) . '~',
+                    $this->optionValues[$option->optionName]
+                )
+            ) {
+                throw new UserInputException($option->optionName, 'validationFailed');
             }
         }