Fix off-by-one in selectOptions (phpBB 3.1+)
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 1 Oct 2020 10:18:37 +0000 (12:18 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 1 Oct 2020 10:19:38 +0000 (12:19 +0200)
Apparently the `option_id` is 0-indexed, but the value selected by the user is
stored 1-indexed. Technically the underscore workaround could now be removed.

files/lib/system/exporter/PhpBB31xExporter.class.php

index bdc17b7518a10ec6fdc6ce860987752c086b64d4..02f33fd2da49e4af202a8ae83e5726273f2597ee 100644 (file)
@@ -420,7 +420,7 @@ class PhpBB31xExporter extends AbstractExporter {
                
                $sql = "SELECT          fields.*,
                                        (
-                                               SELECT  GROUP_CONCAT(('_' || lang.option_id || ':' || lang.lang_value) SEPARATOR '\n')
+                                               SELECT  GROUP_CONCAT(('_' || (lang.option_id + 1) || ':' || lang.lang_value) SEPARATOR '\n')
                                                FROM            ".$this->databasePrefix."profile_fields_lang lang
                                                WHERE           lang.field_id = fields.field_id
                                                        AND     lang.field_type = ?