Force a sane value for `REGISTER_ACTIVATION_METHOD`
authorAlexander Ebert <ebert@woltlab.com>
Fri, 13 Nov 2020 12:33:17 +0000 (13:33 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 13 Nov 2020 12:33:17 +0000 (13:33 +0100)
Fixes #3723

com.woltlab.wcf/package.xml
wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_fixActivationMethod.php [new file with mode: 0644]

index c8871c49100f42a3a02cf8e95481969c877acaef..04af14992eea0c218a5a3c48b30fe347a3701dc5 100644 (file)
@@ -91,6 +91,8 @@
                
                <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.3_invalidateMailForm.php</instruction>
                
+               <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.3_fixActivationMethod.php</instruction>
+               
                <instruction type="script" run="standalone">acp/update_com.woltlab.wcf_5.3_style.php</instruction>
                
                <instruction type="style" run="standalone">defaultStyle.tar</instruction>
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_fixActivationMethod.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3_fixActivationMethod.php
new file mode 100644 (file)
index 0000000..70e6b12
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+use wcf\data\option\OptionEditor;
+
+// Legacy versions handled disabled option values incorrectly, causing them to be unset
+// instead of maintaining the previously selected value. As a result, installations that
+// disabled the registration in WoltLab Suite 3.1 without enabling it again may have an
+// empty string value set for the activation method.
+//
+// See https://github.com/WoltLab/WCF/issues/3723
+if (!is_numeric(REGISTER_ACTIVATION_METHOD)) {
+       OptionEditor::import([
+               'register_activation_method' => 0,
+       ]);
+}